package server import ( "context" "net/http" "github.com/labstack/echo/v5" ) // HealthChecker reports the health of a dependency. type HealthChecker interface { Health(ctx context.Context) map[string]string } type HealthHandler struct { db HealthChecker } func NewHealthHandler(db HealthChecker) *HealthHandler { return &HealthHandler{db: db} } // HealthCheck godoc // // @Summary Check server health // @Description Returns the health status of the server // @Tags health // @Produce json // @Success 200 {object} map[string]string // @Router /health [get] func (h *HealthHandler) HealthCheck(ctx *echo.Context) error { return ctx.JSON(http.StatusOK, h.db.Health(ctx.Request().Context())) }