router.go 381 B

123456789101112131415161718192021
  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. GroupAPI(opts...),
  11. NewAPI(opts...),
  12. }
  13. return func(s *gin.Engine) {
  14. for _, route := range routes {
  15. route(s)
  16. }
  17. }
  18. }