mirror of
https://github.com/Noooste/garage-ui.git
synced 2026-07-26 07:48:13 +00:00
32 lines
626 B
Go
32 lines
626 B
Go
package handlers
|
|
|
|
import (
|
|
"time"
|
|
|
|
"Noooste/garage-ui/internal/models"
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// HealthHandler handles health check requests
|
|
type HealthHandler struct {
|
|
version string
|
|
}
|
|
|
|
// NewHealthHandler creates a new health check handler
|
|
func NewHealthHandler(version string) *HealthHandler {
|
|
return &HealthHandler{
|
|
version: version,
|
|
}
|
|
}
|
|
|
|
// Check returns the health status of the service
|
|
func (h *HealthHandler) Check(c fiber.Ctx) error {
|
|
response := models.HealthResponse{
|
|
Status: "healthy",
|
|
Timestamp: time.Now(),
|
|
Version: h.version,
|
|
}
|
|
|
|
return c.JSON(models.SuccessResponse(response))
|
|
}
|