linstrom/server/middlewares/middleswares.go
2024-05-31 11:54:39 +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
}