https://gin-gonic.com/zh-cn/docs/

    1. package main
    2. import "github.com/gin-gonic/gin"
    3. func main() {
    4. r := gin.Default()
    5. r.GET("/ping", func(c *gin.Context) {
    6. c.JSON(200, gin.H{
    7. "message": "pong",
    8. })
    9. })
    10. r.Run() // 监听并在 0.0.0.0:8080 上启动服务
    11. }