#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 { // ATTENTION !!! // обязательно реализовать инициализацию БД const std::string con = "postgres://chatlanin:password_for_connection_to_test_db@localhost:5423/test.db?sslmode=disable"; try { PGXX().init("con_1", 300, con); PGXX().init("con_2", 300, con); } catch(hack::exception& ex) { ex.log(); throw; } trs::client cli {"localhost:5000"}; cli.set_token("token"); trs::client cli_2 { std::move(cli) }; auto r = cli_2.post("func_name", trs::JSON{{ "key", "test message" }}); hack::log()(r.text, r.status_code); trs::server srv; srv.init("test service"); srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider); srv.run(); }