2024-07-09 11:07:45 +03:00
|
|
|
#include "trs/trs.hpp"
|
|
|
|
|
|
|
|
namespace worckspaces
|
|
|
|
{
|
2024-07-10 11:05:21 +03:00
|
|
|
namespace json_data
|
|
|
|
{
|
|
|
|
inline auto healthcheck = R"(
|
|
|
|
{
|
|
|
|
"key": "value"
|
|
|
|
}
|
|
|
|
)"_json;
|
|
|
|
}
|
|
|
|
|
2024-07-09 11:07:45 +03:00
|
|
|
inline void inspector(trs::transaction& tr)
|
|
|
|
{
|
2024-07-10 11:05:21 +03:00
|
|
|
trs::helpers::json_compare(tr, json_data::healthcheck);
|
2024-07-09 11:07:45 +03:00
|
|
|
}
|
2024-07-10 09:32:45 +03:00
|
|
|
|
|
|
|
inline void provider(trs::transaction& tr)
|
|
|
|
{
|
|
|
|
hack::log()("provider", tr.m_data.m_payload);
|
|
|
|
tr.m_data.m_result["status"] = "ok";
|
|
|
|
tr.m_data.m_result["result"] = "super ok";
|
|
|
|
}
|
2024-07-09 11:07:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
auto main(int argc, char* args[]) -> int
|
|
|
|
{
|
|
|
|
trs::http app;
|
2024-07-10 13:06:57 +03:00
|
|
|
app.init("test service", "app_connection", "log_connection");
|
2024-07-10 09:32:45 +03:00
|
|
|
app.registration("healthcheck", worckspaces::inspector, worckspaces::provider);
|
2024-07-09 11:07:45 +03:00
|
|
|
app.run();
|
|
|
|
}
|