https://github.com/phogolabs/example-api
An example that illustrates how to build REST API form OpenAPI specification by using stride and prana
https://github.com/phogolabs/example-api
golang open-api-v3 prana restful-api stride
Last synced: 7 months ago
JSON representation
An example that illustrates how to build REST API form OpenAPI specification by using stride and prana
- Host: GitHub
- URL: https://github.com/phogolabs/example-api
- Owner: phogolabs
- License: mit
- Created: 2019-12-13T13:59:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-13T17:04:08.000Z (almost 6 years ago)
- Last Synced: 2024-04-30T10:24:57.041Z (over 1 year ago)
- Topics: golang, open-api-v3, prana, restful-api, stride
- Language: Go
- Size: 20.5 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swagger Bank API
API version: 1.0.0
### Overview
This server was generated by [stride](https://github.com/phogolabs/stride) project.
### Prerequisite
You should have the following tools installed:
- [Golang](https://www.golang.org) language (at least version 1.12)
*Make sure that the environment variable `GOPATH` is set. The `GOPATH` directory
will be used as workspace directory for all GO projects.*### Getting Started
if you host the source code on git and your project has a private dependencies
you should configure your git client to use git protocol. For instance for
GitHub the command that does that should be:```
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
```The dependencies are managed by Golang's
[modules](https://github.com/golang/go/wiki/Modules) dependency system:```bash
$ export GO111MODULE=on
$ export PROJECT_PKG=github.com/phogolabs/example-api
$ cd $GOPATH/src/$PROJECT_PKG
$ go get ./...
```### Running the tests
The packages is tested in
[BDD](https://en.wikipedia.org/wiki/Behavior-driven_development) style. For
that purpose, we are using [Ginkgo](http://onsi.github.io/ginkgo/) and
[Gomega](http://onsi.github.io/gomega/) packages.You can install all of them by executing the following commands:
```bash
$ go get github.com/onsi/ginkgo/ginkgo
$ go get github.com/onsi/gomega
```Then you can run all tests with the following command:
```bash
$ ginkgo -r
```### Building the binary
```bash
$ mkdir -p build
$ go build -o ./build/example-api $PROJECT_PKG/cmd/example-api
```### Running the server
To run the server, follow these simple steps:
```bash
# run the compiled binary
$ ./build/example-api
``````bash
# another option is just to use golang command line tool
$ go run cmd/example-api/main.go
```