summaryrefslogtreecommitdiff
path: root/middleware/use.go
diff options
context:
space:
mode:
authorAlexander <a.kiryukhin@vk.team>2024-06-11 14:12:30 +0300
committerAlexander <a.kiryukhin@vk.team>2024-06-11 14:12:30 +0300
commit88a6b1cb628e4e334068e861ac5fb56274d88845 (patch)
tree312f2a3a7182b6e2fc45e87ec71ddde9861c77f8 /middleware/use.go
InitialHEADmaster
Diffstat (limited to 'middleware/use.go')
-rw-r--r--middleware/use.go13
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
+}