generated from datumforge/go-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
base.go
46 lines (37 loc) · 1.01 KB
/
base.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package route
import (
"net/http"
echo "github.com/datumforge/echox"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/datumforge/datum/internal/httpserve/handlers"
)
func registerLivenessHandler(router *echo.Echo) (err error) {
_, err = router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/livez",
Handler: func(c echo.Context) error {
return c.JSON(http.StatusOK, echo.Map{
"status": "UP",
})
},
}.ForGroup(unversioned, mw))
return
}
func registerReadinessHandler(router *echo.Echo, h *handlers.Handler) (err error) {
_, err = router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/ready",
Handler: func(c echo.Context) error {
return h.ReadyChecks.ReadyHandler(c)
},
}.ForGroup(unversioned, mw))
return
}
func registerMetricsHandler(router *echo.Echo) (err error) {
_, err = router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/metrics",
Handler: echo.WrapHandler(promhttp.Handler()),
}.ForGroup(unversioned, mw))
return
}