Gin is a web framework written in go, which implements APIs similar to the Martini framework with better performance.
# Install gin
stepping down in the command line (Recommended learning: Go )
go get -u github.com/gin-gonic/gin
Test whether Gin is installed successfully
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 }
Execute test.go
go run test.go
curl 127.0.0.1:8080/ping
The above is the detailed content of How to install golang gin. For more information, please follow other related articles on the PHP Chinese website!