Gin 框架 官网 https://github.com/gin-gonic/gin https://gin-gonic.com/ 安装 go get -u github.com/gin-gonic/gin 快速使用 package main import ( "github.com/gin-gonic/gin" "net/http" ) func pong(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ // type H map[string]interface{} "message": "pong", }) } func main() { r := gin.Default() r.GET("/ping", pong) r.Run(":8081") } 配置方法 package main import "github.com/gin-gonic/gin" func main() { // router := gin.New() // Default 会默认 开启