mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-11-02 15:15:51 +00:00
fix: configure middlewares before groups
This commit is contained in:
@@ -148,9 +148,6 @@ func (app *BootstrapApp) Setup() error {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
}
|
||||
|
||||
router := engine.Group("/")
|
||||
apiRouter := router.Group("/api")
|
||||
|
||||
// Create middlewares
|
||||
var middlewares []Middleware
|
||||
|
||||
@@ -169,9 +166,13 @@ func (app *BootstrapApp) Setup() error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to initialize %s middleware: %T", middleware, err)
|
||||
}
|
||||
router.Use(middleware.Middleware())
|
||||
engine.Use(middleware.Middleware())
|
||||
}
|
||||
|
||||
// Create routers
|
||||
mainRouter := engine.Group("/")
|
||||
apiRouter := engine.Group("/api")
|
||||
|
||||
// Create controllers
|
||||
contextController := controller.NewContextController(controller.ContextControllerConfig{
|
||||
ConfiguredProviders: configuredProviders,
|
||||
@@ -201,7 +202,7 @@ func (app *BootstrapApp) Setup() error {
|
||||
|
||||
resourcesController := controller.NewResourcesController(controller.ResourcesControllerConfig{
|
||||
ResourcesDir: app.Config.ResourcesDir,
|
||||
}, router)
|
||||
}, mainRouter)
|
||||
|
||||
healthController := controller.NewHealthController(apiRouter)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user