diff --git a/server/options.go b/server/options.go index f7a183f..14dda02 100644 --- a/server/options.go +++ b/server/options.go @@ -2,6 +2,7 @@ package server import ( "log/slog" + "net/http" "time" "github.com/go-chi/chi/v5" @@ -32,3 +33,7 @@ func WithWriteTimeout(d time.Duration) Option { func WithIdleTimeout(d time.Duration) Option { return func(server *Server) { server.idleTimeout = d } } + +func WithMiddleware(mw func(http.Handler) http.Handler) Option { + return func(server *Server) { server.Router.Use(mw) } +}