MCPcopy Create free account
hub / github.com/MITK/MITK / HandleGET_health

Method HandleGET_health

Modules/RESTAPI/src/mitkHealthController.cpp:32–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void 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
59void HealthController::HandleGET_info(const httplib::Request& /*req*/, httplib::Response& res)
60{

Calls 2

HasDataStorageMethod · 0.45
valueMethod · 0.45