linstrom/server-old/middlewares/middleswares.go

15 lines
287 B
Go
Raw Normal View History

2024-05-31 09:54:39 +00:00
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
}