Add healthcheck endpoint

This commit is contained in:
2024-03-23 18:53:07 +01:00
parent 6f7673c0a9
commit 63d13f6ba5
3 changed files with 190 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/vcscsvcscs/GenerationsHeritage/backend/liveness"
)
var (
@@ -40,13 +41,11 @@ func main() {
gin.DefaultWriter = io.MultiWriter(f)
}
}
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
log.SetOutput(gin.DefaultErrorWriter)
hc := liveness.New()
router := gin.Default()
router.GET("/health", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "ok",
})
})
router.GET("/health", hc.HealthCheckHandler())
}