feat: make APIHandler consistent with other handlers
This commit is contained in:
@@ -5,11 +5,12 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
httpSwagger "github.com/swaggo/http-swagger"
|
||||
"goyco/internal/config"
|
||||
"goyco/internal/handlers"
|
||||
"goyco/internal/middleware"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
httpSwagger "github.com/swaggo/http-swagger"
|
||||
)
|
||||
|
||||
type RouterConfig struct {
|
||||
@@ -108,15 +109,13 @@ func NewRouter(cfg RouterConfig) http.Handler {
|
||||
if cfg.UserHandler != nil {
|
||||
modules = append(modules, cfg.UserHandler)
|
||||
}
|
||||
if cfg.APIHandler != nil {
|
||||
modules = append(modules, cfg.APIHandler)
|
||||
}
|
||||
|
||||
for _, module := range modules {
|
||||
module.MountRoutes(api, routeConfig)
|
||||
}
|
||||
|
||||
if cfg.APIHandler != nil {
|
||||
apiRateLimited := api.With(middleware.GeneralRateLimitMiddlewareWithLimit(cfg.RateLimitConfig.GeneralLimit))
|
||||
apiRateLimited.Get("/", cfg.APIHandler.GetAPIInfo)
|
||||
}
|
||||
})
|
||||
|
||||
staticDir := cfg.StaticDir
|
||||
|
||||
Reference in New Issue
Block a user