GoLang with Gin 🍺

Maneesha Indrachapa
7 min readAug 28, 2022

When you read the title of this article you may be wondering if this article is about some alcohol thing but it is not. The Gin framework is the most popular HTTP framework using the Go language.

What is Gin?

First, let’s see what is this Gin. According to the Gin documentation

Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API but with performance up to 40 times faster than Martini. If you need a smashing performance, get yourself some Gin.

So basically Gin is a framework which helps to create Web API in a globally recognized standard way which has really good performance compared to the other programming language frameworks.

Create API endpoints using the Gin framework

Let's see how we can use this Gin framework and build some basic endpoints so you can have an idea of how to use the framework to create simple endpoints. We will use the same source code which we used in the previous article (Go with .env files using Viper)

First, we need to add the Gin framework to our project as a library, to do that you need to open the command prompt and run the below command

go get -u github.com/gin-gonic/gin

--

--