create health check handler

health check
This commit is contained in:
Ruidy 2024-08-06 11:49:59 +02:00
parent 118a18fc9f
commit 3d98d1f287
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
3 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,13 @@
package server
import (
"net/http"
"github.com/labstack/echo/v4"
)
func handleHealthCheck() echo.HandlerFunc {
return func(c echo.Context) error {
return c.String(http.StatusOK, "healthy")
}
}

View file

@ -10,6 +10,7 @@ import (
func (s Server) MountHandlers() { func (s Server) MountHandlers() {
// public // public
s.Router.GET("/health", handleHealthCheck())
s.Router.GET("/debug/pprof/*", echo.WrapHandler(http.DefaultServeMux)) s.Router.GET("/debug/pprof/*", echo.WrapHandler(http.DefaultServeMux))
s.Router.GET("/", handleLoginPage()) s.Router.GET("/", handleLoginPage())
s.Router.POST("/", handleLogin(s.as)) s.Router.POST("/", handleLogin(s.as))

View file

@ -34,6 +34,7 @@ type Server struct {
addr string addr string
secretKey string secretKey string
apiKey string apiKey string
Health *HealthHandler
} }
type options struct { type options struct {