You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
538 B

2 years ago
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",
})
})
}