26 lines
556 B
Go
26 lines
556 B
Go
package http
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/charawein/mtusi2026lab2/internal/transport/httputil"
|
|
)
|
|
|
|
type HealthHandler struct{}
|
|
|
|
func NewHealthHandler() *HealthHandler {
|
|
return &HealthHandler{}
|
|
}
|
|
|
|
func (h *HealthHandler) Live(w http.ResponseWriter, r *http.Request) {
|
|
httputil.WriteJSON(w, r, http.StatusOK, healthResponse{Status: "ok"})
|
|
}
|
|
|
|
func (h *HealthHandler) Ready(w http.ResponseWriter, r *http.Request) {
|
|
httputil.WriteJSON(w, r, http.StatusOK, healthResponse{Status: "ok"})
|
|
}
|
|
|
|
type healthResponse struct {
|
|
Status string `json:"status"`
|
|
}
|