diff options
author | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-29 02:38:17 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <i@neonxp.ru> | 2024-07-29 02:38:17 +0300 |
commit | 2916082d5ed94ef86ad58bdb7256ae07b214c4f3 (patch) | |
tree | 322a0e9172c07457a892f9737839843b8c584864 /middleware.go |
Начальный коммит
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 +} |