trs/tests/main.cpp

38 lines
845 B
C++
Raw Normal View History

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
}
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
{
2024-07-12 20:19:49 +03:00
// trs::client cli {"localhost:5000", "token_auth"};
2024-07-15 09:33:59 +03:00
// trs::client cli_2 { std::move(cli) };
// cli_2.post("func_name",trs::JSON{{ "key", "test message" }});
2024-07-12 11:47:50 +03:00
2024-07-12 20:19:49 +03:00
trs::server srv;
2024-07-15 11:10:29 +03:00
srv.init("test service", "log_connection");
2024-07-12 20:19:49 +03:00
srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider);
srv.run();
2024-07-09 11:07:45 +03:00
}