ferry/router/router.go

38 lines
828 B
Go
Raw Normal View History

2020-07-13 20:33:20 +08:00
package router
import (
"ferry/pkg/jwtauth"
jwt "ferry/pkg/jwtauth"
"github.com/gin-gonic/gin"
_ "github.com/gin-gonic/gin"
)
// 路由示例
func InitExamplesRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Engine {
// 无需认证的路由
examplesNoCheckRoleRouter(r)
// 需要认证的路由
examplesCheckRoleRouter(r, authMiddleware)
return r
}
// 无需认证的路由示例
func examplesNoCheckRoleRouter(r *gin.Engine) {
//v1 := r.Group("/api/v1")
//v1.GET("/examples/list", examples.apis)
}
// 需要认证的路由示例
func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddleware) {
//v1 := r.Group("/api/v1")
//v1auth := v1.Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
//{
// v1auth.GET("/examples/list", examples.apis)
//}
}