Files
vibesonic/internal/web/health.go
T

18 lines
434 B
Go

package web
import "net/http"
func (h *Web) handleHealthz(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("ok"))
}
func (h *Web) handleReadyz(w http.ResponseWriter, r *http.Request) {
if err := h.DB.PingContext(r.Context()); err != nil {
http.Error(w, "database unavailable", http.StatusServiceUnavailable)
return
}
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("ok"))
}