2019-11-15 03:03:56 +00:00
|
|
|
package middleware
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2019-11-26 19:17:01 +00:00
|
|
|
|
|
|
|
"git.kirsle.net/apps/gophertype/pkg/console"
|
2019-11-15 03:03:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ExampleMiddleware is a test middleware.
|
|
|
|
func ExampleMiddleware(next http.Handler) http.Handler {
|
|
|
|
middleware := func(w http.ResponseWriter, r *http.Request) {
|
2019-11-26 19:17:01 +00:00
|
|
|
console.Warn("ExampleMiddleware called on route %s", r.URL.Path)
|
2019-11-15 03:03:56 +00:00
|
|
|
next.ServeHTTP(w, r)
|
|
|
|
}
|
|
|
|
|
|
|
|
return http.HandlerFunc(middleware)
|
|
|
|
}
|