This repository contains a boilerplate REST API service using Gin web framework.
This boilerplate can be used to quickly bootstrap a backend project with minimal changes. It uses most common and highly adpated libraries like zerolog for logging and viper for env configuration.
I have also written a blog where I explain the process behind creating this boilerplate, feel free to check it out.
- HTTP and HTTPS support
- .env file and OS environment variables support
- Models
- Controllers
- Routers
- Request ID middleware
- Request logging middleware
- CORS middleware
Follow these steps to run this service locally
- Get dependencies
go get .
- Set environment variables - use the sample .env file provided in the repository
Execute go run main.go
command at the repository root to start the service.
This repo includes the sample Dockerfile and docker-compose.yaml files that can be used as a reference.