gophertype/pkg/middleware/example.go

17 lines
344 B
Go
Raw Normal View History

2019-11-15 03:03:56 +00:00
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)
}