mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
create health check handler
health check
This commit is contained in:
parent
118a18fc9f
commit
3d98d1f287
3 changed files with 15 additions and 0 deletions
13
internal/server/handle_health.go
Normal file
13
internal/server/handle_health.go
Normal 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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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))
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue