16 lines
364 B
Go
16 lines
364 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func middlewareLogger(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
// Do stuff here
|
|
log.Printf("%s: %s", r.Method, r.RequestURI)
|
|
// Call the next handler, which can be another middleware in the chain, or the final handler.
|
|
next.ServeHTTP(w, r)
|
|
})
|
|
}
|