router.go 362 B

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