diff options
author | Alexander <a.kiryukhin@vk.team> | 2024-06-11 14:12:30 +0300 |
---|---|---|
committer | Alexander <a.kiryukhin@vk.team> | 2024-06-11 14:12:30 +0300 |
commit | 88a6b1cb628e4e334068e861ac5fb56274d88845 (patch) | |
tree | 312f2a3a7182b6e2fc45e87ec71ddde9861c77f8 /middleware/use.go |
Diffstat (limited to 'middleware/use.go')
-rw-r--r-- | middleware/use.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/middleware/use.go b/middleware/use.go new file mode 100644 index 0000000..6610e2f --- /dev/null +++ b/middleware/use.go @@ -0,0 +1,13 @@ +package middleware + +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 +} |