API version: 1.0.0
This server was generated by stride project.
You should have the following tools installed:
- Golang 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.
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 dependency system:
$ export GO111MODULE=on
$ export PROJECT_PKG=github.com/phogolabs/example-api
$ cd $GOPATH/src/$PROJECT_PKG
$ go get ./...
The packages is tested in BDD style. For that purpose, we are using Ginkgo and Gomega packages.
You can install all of them by executing the following commands:
$ go get github.com/onsi/ginkgo/ginkgo
$ go get github.com/onsi/gomega
Then you can run all tests with the following command:
$ ginkgo -r
$ mkdir -p build
$ go build -o ./build/example-api $PROJECT_PKG/cmd/example-api
To run the server, follow these simple steps:
# run the compiled binary
$ ./build/example-api
# another option is just to use golang command line tool
$ go run cmd/example-api/main.go