mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add healthcheck.
This commit is contained in:
@ -58,6 +58,11 @@ func (api *ApiManagerCtx) Route(r chi.Router) {
|
||||
r.Route(path, router)
|
||||
}
|
||||
})
|
||||
|
||||
r.Get("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
//nolint
|
||||
w.Write([]byte("true"))
|
||||
})
|
||||
}
|
||||
|
||||
func (api *ApiManagerCtx) Authenticate(next http.Handler) http.Handler {
|
||||
|
@ -13,6 +13,12 @@ func Logger(next http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
req := map[string]interface{}{}
|
||||
|
||||
// exclude healthcheck from logs
|
||||
if r.RequestURI == "/api/health" {
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
if reqID := middleware.GetReqID(r.Context()); reqID != "" {
|
||||
req["id"] = reqID
|
||||
}
|
||||
|
Reference in New Issue
Block a user