This boilerplate is build with traditional web applications and microservices in Go using the Gin framework with MongoDB as a database.
Gin is a framework that reduces boilerplate code that would normally go into building these applications. It also lends itself very well to creating reusable and extensible pieces of code.
This boilerplate will help you to set up your projects with following prerequisites while developing the rest API.
You will need the following prerequisites installed on your machine.
- Go (Setup Go Enviourment)
- MongoDB (Setup MongoDB Enviourment)
Install all Go.mod dependencies
go list -m all
Install Swagger
go get github.com/go-swagger/go-swagger/cmd/swagger
Install Air
go get -u github.com/cosmtrek/air
Run the application just write following command
air
Create the following environment variable
APP_MODE = prod