/go-rest-template-v2

Golang Gin API REST Template v2

Primary LanguageGo

Golang REST API

Environment variables:

  • configFilePath: string
  • logFilePath: string
  • jwtTokenSecret: string

Allows Queries:

http://localhost:3000/api/users?username=Antonio

Generate Docs

# Get swag
go get -u github.com/swaggo/swag/cmd/swag

# Generate docs
swag init --parseDependency --output docs

Run and go to http://localhost:3000/docs/index.html

Run with Docker

  1. Build
make build
docker build . -t api-rest
  1. Run
docker run -p 3000:3000 api-rest
  1. Test
go test -v ./test/...

Generate code

python .\utils\generators\main.py
  • Set the new Component inside internal/config/database.go --> migration()
  • Set the new Component inside internal/app.go --> SetRoutes()