gophertype/pkg/middleware/example.go

18 lines
386 B
Go

package middleware
import (
"net/http"
"git.kirsle.net/apps/gophertype/pkg/console"
)
// ExampleMiddleware is a test middleware.
func ExampleMiddleware(next http.Handler) http.Handler {
middleware := func(w http.ResponseWriter, r *http.Request) {
console.Warn("ExampleMiddleware called on route %s", r.URL.Path)
next.ServeHTTP(w, r)
}
return http.HandlerFunc(middleware)
}