This commit is contained in:
2024-07-19 17:04:42 +02:00
commit 5e0d0ec69f
71 changed files with 3316 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package health
import (
"net/http"
"github.com/gin-gonic/gin"
)
// @openapi:path
// /_health:
//
// get:
// tags:
// - "Monitoring"
// summary: Health check
// description: Health check
// responses:
// 200:
// description: "Health response"
// content:
// application/json:
// schema:
// $ref: "#/components/schemas/Health"
func GetHealth(c *gin.Context) {
health := &Health{Alive: true}
c.JSON(http.StatusOK, health)
}

View File

@@ -0,0 +1,8 @@
package health
// Health struct
// @openapi:schema.
type Health struct {
Alive bool `json:"alive"`
Version string `json:"version"`
}

View File

@@ -0,0 +1,15 @@
package health
import (
"mangezmieux-backend/internal/ginserver"
"mangezmieux-backend/internal/injector"
"net/http"
"github.com/gin-gonic/gin"
)
func Setup(inj *injector.Injector) {
publicRoute := injector.Get[*gin.RouterGroup](inj, ginserver.UnsecuredRouterInjectorKey)
publicRoute.Handle(http.MethodGet, "/health", GetHealth)
}