36 lines
812 B
C++
36 lines
812 B
C++
#include "hack/exception/exception.hpp"
|
|
|
|
#include "trs/trs.hpp"
|
|
#include "trs/utils/var.hpp"
|
|
|
|
namespace worckspaces
|
|
{
|
|
inline void inspector(trs::transaction& tr)
|
|
{
|
|
if (tr.m_data.m_payload.size() != 0)
|
|
{
|
|
hack::exception ex;
|
|
ex.description("transaction payload size > 0 but payload must be empty");
|
|
ex.message(trs::var::NO_VALID_DATA);
|
|
ex.commit();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
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::http app;
|
|
app.init("app_connection", "log_connection");
|
|
|
|
app.registration("healthcheck", worckspaces::inspector, worckspaces::provider);
|
|
app.run();
|
|
}
|