router.go 341 B

12345678910111213141516171819
  1. package routers
  2. import (
  3. "github.com/gin-gonic/gin"
  4. )
  5. // HTTPServerRoute 核心 App 服务 HTTP 路由
  6. func HTTPServerRoute(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
  7. routes := []func(s *gin.Engine){
  8. Root(opts...),
  9. AppAPI(opts...),
  10. }
  11. return func(s *gin.Engine) {
  12. for _, route := range routes {
  13. route(s)
  14. }
  15. }
  16. }