init(app) moved app code from Lab1

This commit is contained in:
imadev
2026-10-21 16:42:14 +03:00
parent 65003b6119
commit 1db3953226
22 changed files with 1297 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
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"})
}