ron-example/middleware.go
2024-11-19 23:17:14 +01:00

21 lines
444 B
Go

package main
import (
"log/slog"
"net/http"
)
func someMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
slog.Info("triggered middleware")
next.ServeHTTP(w, r)
})
}
func anotherMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
slog.Info("triggered another middleware")
next.ServeHTTP(w, r)
})
}