Files
mtusi2026lab2/app/internal/health/handler.go
T

28 lines
524 B
Go

package health
import (
"sync/atomic"
"gitflic.ru/project/bulla-max/mtusi2026lab1/internal/common"
"github.com/gofiber/fiber/v3"
)
var shuttingDown atomic.Bool
func SignalShutdown() {
shuttingDown.Store(true)
}
func live(c fiber.Ctx) error {
return c.JSON(fiber.Map{"status": "ok"})
}
func ready(c fiber.Ctx) error {
if shuttingDown.Load() {
return common.SendError(c, fiber.StatusInternalServerError,
common.ErrorCodeInternal, "app currently shutting down")
}
return c.JSON(fiber.Map{"status": "ok"})
}