» Go: Build a REST API with Gin » 1. Introduction » 1.1 Preparation

Preparation

Install Go

See How to install Go?.

Note: This project uses Go 1.20.4.

Pick an editor

Pick your favorite editor or use Visual Studio Code.

Learn Go basics

If you're not familiar with Go, you may try this tutorial: "Quick Introduction to Go."

What is REST api

See What is REST api?.

Gin web framework

Gin is a web framework written in Golang. It features a Martini-like API, but with performance up to 40 times faster than Martini. If you need performance and productivity, you will love Gin.

Here's a basic usage example:

package main

import "github.com/gin-gonic/gin"

func main() {
	r := gin.Default()
	r.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})
	r.Run() // listen and serve on 0.0.0.0:8080
}
Next