| 30 | } |
| 31 | |
| 32 | void HealthController::HandleGET_health(const httplib::Request& /*req*/, httplib::Response& res) |
| 33 | { |
| 34 | nlohmann::json response; |
| 35 | response["data"]["status"] = "healthy"; |
| 36 | |
| 37 | nlohmann::json checks; |
| 38 | checks["datastorage"] = m_Bridge.HasDataStorage() ? "ok" : "unavailable"; |
| 39 | // Note: rendering check is planned for a future version |
| 40 | response["data"]["checks"] = checks; |
| 41 | |
| 42 | // Add uptime if available |
| 43 | { |
| 44 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 45 | if (m_UptimeCallback) |
| 46 | { |
| 47 | auto uptime = m_UptimeCallback(); |
| 48 | if (uptime.has_value()) |
| 49 | { |
| 50 | response["data"]["uptime_seconds"] = uptime.value(); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | res.status = 200; |
| 56 | res.set_content(response.dump(), "application/json"); |
| 57 | } |
| 58 | |
| 59 | void HealthController::HandleGET_info(const httplib::Request& /*req*/, httplib::Response& res) |
| 60 | { |