8f8b555ea5
Build / build (push) Successful in 48s
- Split IndexHandler into HealthHandler, VersionHandler, and CharacterHandler - Rename index.go to version.go in backend - Change VersionData.Changelog from string to []string - Add changelog entries for issues #16-#23 - Remove TestDB function and related code - Fix import ordering in several files Closes #21, #22 References #16, #17, #18, #19, #20, #23 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
29 lines
542 B
Go
29 lines
542 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v5"
|
|
"music-server/internal/db"
|
|
)
|
|
|
|
type HealthHandler struct {
|
|
}
|
|
|
|
func NewHealthHandler() *HealthHandler {
|
|
return &HealthHandler{}
|
|
}
|
|
|
|
// HealthCheck godoc
|
|
//
|
|
// @Summary Check server health
|
|
// @Description Returns the health status of the server
|
|
// @Tags health
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {string} string "OK"
|
|
// @Router /health [get]
|
|
func (h *HealthHandler) HealthCheck(ctx *echo.Context) error {
|
|
return ctx.JSON(http.StatusOK, db.Health())
|
|
}
|