package middleware import ( "log/slog" "net/http" ) func AuthMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { token := r.Header.Get("Authorization") if token == "foobar" { http.Error(w, "Forbidden", http.StatusForbidden) return } next.ServeHTTP(w, r) }) } func LoggingMiddleware(next http.Handler, logger *slog.Logger) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { logger.Info("🚀 handle %s %s", r.Method, r.URL.Path) next.ServeHTTP(w, r) }) }