Skip to content

snoeffels/mygo

Repository files navigation

Golang-Gin-Gorm-Postgres boilerplate

This is a template project for upcoming golang project ideas. It uses gorm as ORM with Postgres and also uses JWT auth middleware if GIN_MODE=release is set in .env / .env-docker

The project also offers a generated swagger ui at http://localhost:8080/swagger-ui/index.html

  • Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.5mhBHqs5_DTLdINd9p5m7ZJ6XD0Xc55kIaCRY5r6HRA

Resources

Run using docker compose

docker compose up --build -d

Run local

go run .

Build & run local

go build .
./main

Test curl

curl https://reqbin.com/echo/get/json
   -H "Accept: application/json"
   -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.5mhBHqs5_DTLdINd9p5m7ZJ6XD0Xc55kIaCRY5r6HRA"

Generate swagger

 go install github.com/swaggo/swag/cmd/swag@latest
 
 swag init -parseDependency=true

Generate dependency injection using googles go:wire

go install github.com/google/wire/cmd/wire

go run github.com/google/wire/cmd/wire

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published