trs/tests/main.cpp
2024-07-15 11:16:42 +03:00

41 lines
894 B
C++

#include "trs/trs.hpp"
namespace worckspaces
{
namespace json_data
{
inline auto healthcheck = R"(
{
"key": "value"
}
)"_json;
}
inline void inspector(trs::transaction& tr)
{
trs::helpers::json_compare(tr, json_data::healthcheck);
}
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";
}
}
auto main(int argc, char* args[]) -> int
{
// trs::client cli {"localhost:5000", "token_auth"};
// trs::client cli_2 { std::move(cli) };
// cli_2.post("func_name",trs::JSON{{ "key", "test message" }});
trs::server srv;
srv.init("test service");
srv.set_log_connection("con");
srv.set_app_connection("con");
srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider);
srv.run();
}