From 7518896cfed4d38eec3bf6661343a4ae703616e0 Mon Sep 17 00:00:00 2001 From: Kharec Date: Tue, 11 Nov 2025 04:20:59 +0100 Subject: [PATCH] feat: make APIHandler consistent with other handlers --- internal/server/router.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/server/router.go b/internal/server/router.go index 32dbdae..ee37d4b 100644 --- a/internal/server/router.go +++ b/internal/server/router.go @@ -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