Unverified Commit 2f1dd94f authored by Ben Ye's avatar Ben Ye Committed by GitHub
Browse files

Add ping API endpoint to check liveness (#646)

Signed-off-by: default avataryeya24 <yb532204897@gmail.com>
Co-authored-by: default avatarti-srebot <66930949+ti-srebot@users.noreply.github.com>
parent cc13462f
Showing with 6 additions and 0 deletions
+6 -0
......@@ -89,6 +89,7 @@ func serverRegister(lx fx.Lifecycle, s *Server, conf *config.ChaosDashboardConfi
mux.Handle("/", http.StripPrefix("/", uiserver.Handler(assetFs)))
mux.Handle("/api/", Handler(s))
mux.Handle("/api/swagger/", swaggerserver.Handler())
mux.HandleFunc("/ping", pingHandler)
srv := &http.Server{Handler: mux}
......@@ -133,3 +134,8 @@ func Handler(s *Server) http.Handler {
s.handler(w, r)
})
}
func pingHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "pong\n")
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment