Gin框架-快速入门

运行这段代码并在浏览器中访问 http://localhost:8080

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
}

Leave a Reply

Your email address will not be published. Required fields are marked *