feat: backend service

This commit is contained in:
Ilia Denisov
2026-05-06 10:14:55 +03:00
committed by GitHub
parent 3e2622757e
commit f446c6a2ac
1486 changed files with 49720 additions and 266401 deletions
+26
View File
@@ -0,0 +1,26 @@
package server
import (
"net/http"
"github.com/gin-gonic/gin"
)
// statusResponse is the body shape returned by both probes.
type statusResponse struct {
Status string `json:"status"`
}
func handleHealthz(c *gin.Context) {
c.JSON(http.StatusOK, statusResponse{Status: "ok"})
}
func handleReadyz(ready func() bool) gin.HandlerFunc {
return func(c *gin.Context) {
if ready != nil && !ready() {
c.JSON(http.StatusServiceUnavailable, statusResponse{Status: "starting"})
return
}
c.JSON(http.StatusOK, statusResponse{Status: "ready"})
}
}