Version: 0.1.0
Example microservice using the Go Gin framework
- Gin - API Router, controllers
- Gom - Package management
- Viper - Configuration
- Stew - Extends common Go objects providing better alternatives or wrappers
- Go to OpenWeatherMap.org, sign up and copy the api key
- Uncomment the following line in config/development.toml
#app_id = "put-your-api-key-here"
- Remove the leading hash character and replace the "put-your-api-key-here" with the api key from your OpenWeatherMap account
$ brew install go
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
$ go get github.com/rbbll/gin-microservice
$ go get github.com/mattn/gom
$ cd $GOPATH/src/github.com/rbbll/gin-microservice
$ gom install
$ VIPER_CONFIG=../config gom test ./app
$ rm -rf _vendor/
$ rm Gomfile.lock
$ gom lock
$ gom install
$ VIPER_CONFIG=../config gom test ./app
$ VIPER_CONFIG=../config gom test -test.v ./app
$ cd $GOPATH/src/github.com/rbbll/gin-microservice
$ mkdir -p coverage
$ VIPER_CONFIG=../config gom test -coverprofile=coverage/coverage.out ./app
$ VIPER_CONFIG=../config gom tool cover -html=coverage/coverage.out -o coverage/coverage.html
$ open coverage/coverage.html
$ gom run main.go
$ gom build
$ VIPER_ENV=development VIPER_CONFIG=./config ./gin-microservice