From d17debd2c7aff8727edba2b17ceb8d47a4ca31f6 Mon Sep 17 00:00:00 2001 From: Behnam M <58621210+ibehnam@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:21:09 -0500 Subject: [PATCH] added /health endpoint to the server --- examples/server/server.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 6c7fcd176..507031eb6 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -2938,7 +2938,13 @@ int main(int argc, char **argv) }); - + svr.Get("/health", [&](const httplib::Request&, httplib::Response& res) { + // Perform necessary internal status checks here + // For demonstration purposes, we'll simply return a status of 'ok' + res.set_content(R"({"status": "ok"})", "application/json"); + res.status = 200; // HTTP OK + }); + svr.Get("/v1/models", [¶ms](const httplib::Request&, httplib::Response& res) { std::time_t t = std::time(0);