Project status: Seeking community reviews (feel free to open issues!)
The goal of this repo is to serve as boilerplate for a Go API. User authentication and interactive Swagger documentation is set up and working out of the box.
- Add more documentation to
README.md
- Copy
docker-compose.example.yml
to a new file calleddocker-compose.yml
- Edit the environment variables in
docker-compose.yml
docker compose up -d
- Visit
{FQDN}:{PORT}/swagger/index.html
for interactive documentation
- Copy
.env.example
to.env
and adjust as needed - Spin up a postgres instance:
docker run --name demo-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=dev -p 5432:5432 -d postgres
- Spin up a Redis instance:
docker run --name demo-redis -p 6379:6379 -d redis
- Download swag (generates
docs
package):go get -u github.com/swaggo/swag/cmd/swag
- Install swag:
go install github.com/swaggo/swag/cmd/swag@latest
- Download air (live-reload app runner, using this to generate Swagger docs on save)
go get -u github.com/cosmtrek/air
- Install air:
go install github.com/cosmtrek/air@latest
- Install dependencies:
go mod download
- Start server:
air
- Visit http://localhost:8080/swagger/index.html for interactive documentation
Swagger notation docs: https://github.com/swaggo/swag#api-operation