package main import ( "github.com/gin-gonic/gin" "simpleCms/app/content" ) // 声明一个main包level的变量 var router = gin.Default() // init 初始化时执行,用于完成API的定义 func init() { // 定义任意的uri,api router.GET("/content/:id", content.Get) router.DELETE("/content/:id", content.Delete) router.PUT("/content/:id", content.Put) router.POST("/content", content.Post) router.GET("/ping", func(c *gin.Context) { // & //c.Query("")// ?name=xx c.JSON(200, gin.H{ "message": "pong", }) }) }