goweb/route/test.go

20 lines
462 B
Go

package route
import (
"github.com/gin-gonic/gin"
"go_api_tmpl/core"
"go_api_tmpl/middleware"
)
func initTestRoute(r *gin.RouterGroup) {
group := r.Group("/test", middleware.AuthorizeJWT())
group.GET("/pub", func(context *gin.Context) {
core.R(context).OkWithMessage("已登录且无需权限可访问")
})
group.GET("/hello", middleware.AuthorityVerify(), func(context *gin.Context) {
core.R(context).OkWithMessage("已登录且有权限")
})
}