From 88a6b1cb628e4e334068e861ac5fb56274d88845 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 11 Jun 2024 14:12:30 +0300 Subject: Initial --- middleware/use.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 middleware/use.go (limited to 'middleware/use.go') 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 +} -- cgit v1.2.3