// Code generated by atomctl. DO NOT EDIT. // Package {{.PackageName}} provides HTTP route definitions and registration // for the {{.ProjectPackage}} application. package {{.PackageName}} import ( {{- if .Imports }} {{- range .Imports }} {{.}} {{- end }} {{- end }} . "go.ipao.vip/atom/fen" _ "go.ipao.vip/atom" _ "go.ipao.vip/atom/contracts" "github.com/gofiber/fiber/v3" log "github.com/sirupsen/logrus" ) // Routes implements the HttpRoute contract and provides route registration // for all controllers in the {{.PackageName}} module. // // @provider contracts.HttpRoute atom.GroupRoutes type Routes struct { log *log.Entry `inject:"false"` {{- if .Controllers }} // Controller instances {{- range .Controllers }} {{.}} {{- end }} {{- end }} } // Prepare initializes the routes provider with logging configuration. func (r *Routes) Prepare() error { r.log = log.WithField("module", "routes.{{.PackageName}}") r.log.Info("Initializing routes module") return nil } // Name returns the unique identifier for this routes provider. func (r *Routes) Name() string { return "{{.PackageName}}" } // Register registers all HTTP routes with the provided fiber router. // Each route is registered with its corresponding controller action and parameter bindings. func (r *Routes) Register(router fiber.Router) { {{- if .RouteGroups }} {{- range $key := .RouteGroups }} // Register routes for controller: {{$key}} {{- $value := index $.Routes $key }} {{- if $value }} {{- range $value }} {{- if .Route }} r.log.Debugf("Registering route: {{.Method}} {{.Route}} -> {{.Controller}}.{{.Action}}") router.{{.Method}}("{{.Route}}", {{.Func}}( r.{{.Controller}}.{{.Action}}, {{- if .Params }} {{- range .Params }} {{.}}, {{- end }} {{- end }} )) {{- end }} {{- end }} {{- end }} {{- end }} {{- else }} r.log.Warn("No routes found to register") {{- end }} r.log.Info("Successfully registered all routes") }