- Git
- Go (minimum 1.13 or above, make sure you set your local machine environment with
GO111MODULE=on
) - Docker compose
- Docker
- Mockgen
- Swag
-
Clone this repository.
-
Run
docker-compose
to build the dependency docker instances:
$ docker-compose up --build
- Make the environment files. Adjust your local configuration.
$ cp config.yaml.tpl .env
- Run these commands to get all the app dependency's
$ swag i
$ go get -v ./...
- Run the app. The app will run inside the local machine with exposed port configured in the env (by default: localhost:3030)
$ go run main.go
Access localhost:3030/swagger/index.html to read the API docs.
Reference to this doc to create a new migration file.
Use mockgen
to create a new mock. Tips: place mock file inside mocks directory
$ mockgen -package=mock -source=/path/to/interface/file -destination=/path/to/generated/mock/file
Use go mod
as dependency tool.
$ go get github.com/gin-gonic/gin
Use go test
to run unit test.
$ go test -v -race -coverprofile=coverage.out -covermode=atomic ./...