From: Sacha Arbonel Date: Mon, 31 Mar 2025 08:03:41 +0000 (+0200) Subject: feat: add health check endpoint to server (#2968) X-Git-Tag: upstream/1.7.5~35 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=88d13a17a7465c6dc79c70da710716f837f0ebdc;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp feat: add health check endpoint to server (#2968) --- 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];