From 88d13a17a7465c6dc79c70da710716f837f0ebdc Mon Sep 17 00:00:00 2001 From: Sacha Arbonel Date: Mon, 31 Mar 2025 10:03:41 +0200 Subject: [PATCH] feat: add health check endpoint to server (#2968) --- examples/server/server.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 88d36e30..f709225b 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -1024,6 +1024,11 @@ int main(int argc, char ** argv) { // check if the model is in the file system }); + svr.Get(sparams.request_path + "/health", [&](const Request &, Response &res){ + const std::string health_response = "{\"status\":\"ok\"}"; + res.set_content(health_response, "application/json"); + }); + svr.set_exception_handler([](const Request &, Response &res, std::exception_ptr ep) { const char fmt[] = "500 Internal Server Error\n%s"; char buf[BUFSIZ];