12345678910111213141516171819202122232425262728293031 |
- package route
- import (
- // m "git.llsapp.com/zhenghe/pkg/http/middleware"
- "kpt-grpc-demo/http/api"
- "github.com/gin-gonic/gin"
- )
- func AppAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
- return func(s *gin.Engine) {
- for _, opt := range opts {
- opt(s)
- }
- // Not Found
- s.NoRoute(api.Handle404)
- // Health Check
- s.GET("/check", api.Health)
- // lingo API 组
- lingoRoute := authRouteGroup(s, "/api/v1/kpt/")
- lingoRoute.GET("/hello", api.Hello)
- }
- }
- func authRouteGroup(s *gin.Engine, relativePath string) *gin.RouterGroup {
- group := s.Group(relativePath)
- // TODO 中间件鉴权
- // group.Use(middleware.Auth(), m.UserKitMiddleware())
- return group
- }
|