package middleware import ( "log" "net/http" "time" ) func ResponseTimeMiddleware(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { start := time.Now() path := r.URL.Path next(w, r) duration := time.Since(start) log.Printf("%+v response time %+v", path, duration) } }