handlers: add health-check endpoints
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-05-13 22:33:38 +02:00
parent ac4cc4ad48
commit 31ab083f8a
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ
2 changed files with 10 additions and 0 deletions

@ -34,6 +34,10 @@ func (a *App) SetupRoutes() {
// alternative:
// e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", assets)))
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
e.GET("/healthz", handlers.Healthz())
e.GET("/health", handlers.Healthz())
e.GET("/", handlers.Index())
e.GET("/signin", handlers.Signin())
e.POST("/signin", handlers.SigninPost(a.db))

@ -52,6 +52,12 @@ func Index() echo.HandlerFunc {
}
}
func Healthz() echo.HandlerFunc {
return func(c echo.Context) error {
return c.String(http.StatusOK, "{\"status\": \"OK\"}")
}
}
func addHeaders(c echo.Context) {
c.Response().Writer.Header().Set("Cross-Origin-Opener-Policy", "same-origin")
}