linstrom/server-old/middlewares/middleswares.go
2024-08-22 19:57:53 +02:00

14 lines
287 B
Go

package middlewares
import "net/http"
type ContextKey string
type MiddlewareFunc func(http.Handler) http.Handler
func ChainMiddlewares(start http.Handler, middlewares ...MiddlewareFunc) http.Handler {
next := start
for _, h := range middlewares {
next = h(next)
}
return next
}