This commit is contained in:
2025-12-20 10:21:14 +08:00
parent 06cc059998
commit 788236ecc2
3 changed files with 14 additions and 2 deletions

View File

@@ -5,8 +5,11 @@ import (
"quyun/v2/app/commands"
"quyun/v2/app/errorx"
web "quyun/v2/app/http"
"quyun/v2/app/jobs"
"quyun/v2/app/middlewares"
_ "quyun/v2/docs"
"quyun/v2/providers/ali"
"quyun/v2/providers/app"
"quyun/v2/providers/http"
"quyun/v2/providers/http/swagger"
@@ -28,6 +31,7 @@ func defaultProviders() container.Providers {
http.DefaultProvider(),
jwt.DefaultProvider(),
job.DefaultProvider(),
ali.DefaultProvider(),
}...)
}
@@ -38,8 +42,12 @@ func Command() atom.Option {
atom.RunE(Serve),
atom.Providers(
defaultProviders().
WithProviders(
web.Providers(),
).
With(
jobs.Provide,
middlewares.Provide,
),
),
)
@@ -69,8 +77,8 @@ func Serve(cmd *cobra.Command, args []string) error {
Data: []byte{},
}))
group := svc.Http.Engine.Group("")
for _, route := range svc.Routes {
group := svc.Http.Engine.Group(route.Path(), route.Middlewares()...).Name(route.Name())
route.Register(group)
}