Files
email-notification/middleware/middleware.go
2025-04-18 18:15:59 +07:00

18 lines
331 B
Go

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)
}
}