add logics
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"backend/modules/middlewares"
|
||||
"backend/modules/users"
|
||||
"backend/providers/app"
|
||||
"backend/providers/http"
|
||||
@@ -31,16 +32,19 @@ func Command() atom.Option {
|
||||
atom.Name("serve"),
|
||||
atom.Short("run http server"),
|
||||
atom.RunE(Serve),
|
||||
atom.Providers(providers),
|
||||
atom.Providers(providers.With(
|
||||
middlewares.Provide,
|
||||
)),
|
||||
)
|
||||
}
|
||||
|
||||
type Http struct {
|
||||
dig.In
|
||||
|
||||
Service *http.Service
|
||||
Initials []contracts.Initial `group:"initials"`
|
||||
Routes []contracts.HttpRoute `group:"routes"`
|
||||
Service *http.Service
|
||||
Initials []contracts.Initial `group:"initials"`
|
||||
Routes []contracts.HttpRoute `group:"routes"`
|
||||
Middlewares *middlewares.Middlewares
|
||||
}
|
||||
|
||||
func Serve(cmd *cobra.Command, args []string) error {
|
||||
@@ -51,6 +55,11 @@ func Serve(cmd *cobra.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
mid := http.Middlewares
|
||||
http.Service.Engine.Use(mid.Verify)
|
||||
http.Service.Engine.Use(mid.AuthUserInfo)
|
||||
http.Service.Engine.Use(mid.SilentAuth)
|
||||
|
||||
return http.Service.Serve()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user