mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 09:27:35 +02:00
23 lines
460 B
Go
23 lines
460 B
Go
package utils
|
|
|
|
import (
|
|
"log/slog"
|
|
"net/http"
|
|
)
|
|
|
|
// HealthCheck Returns a simple health check handler.
|
|
func HealthCheck() http.Handler {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
w.WriteHeader(http.StatusOK)
|
|
_, err := w.Write([]byte("OK"))
|
|
if err != nil {
|
|
slog.Warn("failed to write healthcheck response",
|
|
"component", "healthcheck",
|
|
"method", r.Method,
|
|
"path", r.URL.Path,
|
|
"error", err,
|
|
)
|
|
}
|
|
})
|
|
}
|