2021-09-29 20:40:17 +00:00
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/fasthttp/router"
|
|
|
|
http "github.com/valyala/fasthttp"
|
2021-11-14 21:15:28 +00:00
|
|
|
|
2022-01-12 17:53:00 +00:00
|
|
|
"source.toby3d.me/toby3d/middleware"
|
2022-03-13 10:58:34 +00:00
|
|
|
"source.toby3d.me/toby3d/auth/internal/common"
|
2021-09-29 20:40:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type RequestHandler struct{}
|
|
|
|
|
|
|
|
func NewRequestHandler() *RequestHandler {
|
2021-12-28 23:08:50 +00:00
|
|
|
return &RequestHandler{}
|
2021-09-29 20:40:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *RequestHandler) Register(r *router.Router) {
|
2022-01-12 17:53:00 +00:00
|
|
|
chain := middleware.Chain{
|
|
|
|
middleware.LogFmt(),
|
|
|
|
}
|
|
|
|
|
|
|
|
r.GET("/health", chain.RequestHandler(h.read))
|
2021-09-29 20:40:17 +00:00
|
|
|
}
|
|
|
|
|
2021-12-28 23:08:50 +00:00
|
|
|
func (h *RequestHandler) read(ctx *http.RequestCtx) {
|
2022-01-29 19:50:58 +00:00
|
|
|
ctx.SuccessString(common.MIMEApplicationJSONCharsetUTF8, `{"ok": true}`)
|
2021-09-29 20:40:17 +00:00
|
|
|
}
|