fix middleware
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
@@ -32,3 +33,7 @@ func WithWriteTimeout(d time.Duration) Option {
|
|||||||
func WithIdleTimeout(d time.Duration) Option {
|
func WithIdleTimeout(d time.Duration) Option {
|
||||||
return func(server *Server) { server.idleTimeout = d }
|
return func(server *Server) { server.idleTimeout = d }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithMiddleware(mw func(http.Handler) http.Handler) Option {
|
||||||
|
return func(server *Server) { server.Router.Use(mw) }
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user