]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
feat: add health check endpoint to server (#2968)
authorSacha Arbonel <redacted>
Mon, 31 Mar 2025 08:03:41 +0000 (10:03 +0200)
committerGitHub <redacted>
Mon, 31 Mar 2025 08:03:41 +0000 (11:03 +0300)
examples/server/server.cpp

index 88d36e3067d80c82b280aaae4fd7409723a91280..f709225bd813d7b20b5553be65b1033a108d9c87 100644 (file)
@@ -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];