标签:router github pos package json text 框架 path highlight
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
v1RouterGroup := router.Group("/v1")
{
v1RouterGroup.GET("/users", func(c *gin.Context) {
c.JSON(200, gin.H{
"path" : "/users",
"method" : "GET",
})
})
v1RouterGroup.POST("/users", func(c *gin.Context) {
c.JSON(200, gin.H{
"path" : "/users",
"method" : "POST",
})
})
}
v2RouterGroup := router.Group("/v2")
{
v2RouterGroup.GET("/users", func(c *gin.Context) {
c.JSON(200, gin.H{
"path" : "/users",
"method" : "GET",
})
})
v2RouterGroup.POST("/users", func(c *gin.Context) {
c.JSON(200, gin.H{
"path" : "/users",
"method" : "POST",
})
})
}
router.Run(":8080")
}
标签:router github pos package json text 框架 path highlight
原文地址:https://www.cnblogs.com/juanmaofeifei/p/14276811.html