feat: add health check endpoint to server (#2968)

This commit is contained in:
Sacha Arbonel 2025-03-31 10:03:41 +02:00 committed by GitHub
parent f92bd59951
commit 88d13a17a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View 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];