Files
member-console/internal/middleware/middleware.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

21 lines
550 B
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
package middleware
import "net/http"
type Middleware func(http.Handler) http.Handler
// CreateStack creates a stack of middleware handlers
func CreateStack(middlewares ...Middleware) Middleware {
return func(nextMiddleware http.Handler) http.Handler {
for i := len(middlewares) - 1; i >= 0; i-- {
currentMiddleware := middlewares[i]
nextMiddleware = currentMiddleware(nextMiddleware)
}
return nextMiddleware
}
}