api.go 373 B

123456789101112131415161718192021
  1. // Path: routes 注册路由
  2. package routes
  3. import (
  4. "net/http"
  5. "github.com/gin-gonic/gin"
  6. )
  7. // RegisterAPIRoutes 注册路由
  8. func RegisterAPIRoutes(router *gin.Engine) {
  9. // v1 路由组,所有 v1 版本的路由都放在这里
  10. v1 := router.Group("/v1")
  11. {
  12. v1.GET("/", func(c *gin.Context) {
  13. c.JSON(http.StatusOK, gin.H{
  14. "Hello": "World",
  15. })
  16. })
  17. }
  18. }