first working server

This commit is contained in:
$(pass /github/name)
2024-07-03 09:40:45 +02:00
parent 9bd8d48243
commit 6d34d99835
20 changed files with 340 additions and 128 deletions

View File

@@ -0,0 +1,17 @@
package middlewares
import (
"GoMembership/pkg/logger"
"net/http"
"time"
)
// LoggerMiddleware logs each incoming HTTP request
func LoggerMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
next.ServeHTTP(w, r)
logger.Info.Printf("%s %s %s", r.Method, r.RequestURI, time.Since(start))
})
}