Skip to content

internal/http/middleware

github.com/gamidoc/backend/internal/http/middleware

Functions

BodyLimit

func BodyLimit(maxBytes int64) func(http.Handler) http.Handler {

CORS

func CORS(allowedOrigins []string) func(http.Handler) http.Handler {

GetAuthEmail

func GetAuthEmail(ctx context.Context) string {

GetAuthUserID

func GetAuthUserID(ctx context.Context) string {

GetRequestID

func GetRequestID(ctx context.Context) string {

Logging

func Logging(logger *slog.Logger) func(http.Handler) http.Handler {

loggingResponseWriter.WriteHeader

func (w *loggingResponseWriter) WriteHeader(status int) {

Recovery

func Recovery(logger *slog.Logger) func(http.Handler) http.Handler {

RequestID

func RequestID(next http.Handler) http.Handler {

RequireAuth

func RequireAuth(manager *token.Manager) func(http.Handler) http.Handler {