package middleware import ( "net/http" "slices" ) type HandlerBuilder func(http.Handler) http.Handler func ChainMiddlewares(base http.Handler, links ...HandlerBuilder) http.Handler { slices.Reverse(links) for _, f := range links { base = f(base) } return base }