Skip to content

This repository contains boilerplate code of a REST service using Gin (golang) framework.

License

Notifications You must be signed in to change notification settings

lakhinsu/gin-boilerplate

Repository files navigation

Boilerplate REST service using Gin web framework (Golang)

Go Go Report Card

Introduction

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.

Features

  • HTTP and HTTPS support
  • .env file and OS environment variables support
  • Models
  • Controllers
  • Routers
  • Request ID middleware
  • Request logging middleware
  • CORS middleware

Run locally

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.

Running in Docker

This repo includes the sample Dockerfile and docker-compose.yaml files that can be used as a reference.

About

This repository contains boilerplate code of a REST service using Gin (golang) framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages