From 2916082d5ed94ef86ad58bdb7256ae07b214c4f3 Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Mon, 29 Jul 2024 02:38:17 +0300 Subject: Начальный коммит MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 middleware.go (limited to 'middleware.go') 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 +} -- cgit v1.2.3