gophertype/pkg/middleware/example.go
2019-11-14 19:03:56 -08:00

17 lines
344 B
Go

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