This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
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",
})
}