Gin Router and Route Groups
Engine setup, groups, and path parameters
What is Gin?
Gin is a high-performance HTTP web framework for Go. It uses a radix tree router, provides middleware support, JSON binding, and validation — making it popular for REST APIs.
Installing and basic setup
Import and create a Gin engine:
go get github.com/gin-gonic/gin
package main
func main() {
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "pong"})
})
r.Run(":8080")
}All lessons in this course
- Gin Router and Route Groups
- Request Binding and Validation
- Response Helpers and Status Codes
- Gin Middleware: Auth and Logging