feat(SimpleRouter): add global middleware support

This commit is contained in:
2024-11-18 20:59:20 +01:00
parent 68d274c067
commit 9db64451dd
2 changed files with 32 additions and 4 deletions

View File

@@ -5,7 +5,8 @@ import "net/http"
type Middleware func(http.Handler) http.Handler
type RouteGroup struct {
mux *http.ServeMux // A ponter to the underlying ServeMux, this allows us to call ListenAndServe on any instance
basePath string // The current path we are defining handlers on / appending to
middlewares []Middleware // Stack of middlewares that will be applied on a handler in order
mux *http.ServeMux // A ponter to the underlying ServeMux, this allows us to call ListenAndServe on any instance
basePath string // The current path we are defining handlers on / appending to
middlewares []Middleware // Stack of middlewares that will be applied on a handler in order
global_middlewares []Middleware
}