diff options
Diffstat (limited to 'middleware.go')
-rw-r--r-- | middleware.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/middleware.go b/middleware.go new file mode 100644 index 0000000..2b56105 --- /dev/null +++ b/middleware.go @@ -0,0 +1,13 @@ +package mux + +import "net/http" + +type Middleware func(http.Handler) http.Handler + +func Use(handler http.Handler, middlewares ...Middleware) http.Handler { + for _, h := range middlewares { + handler = h(handler) + } + + return handler +} |