37 lines
858 B
C++
37 lines
858 B
C++
|
#include "hack/exception/exception.hpp"
|
||
|
|
||
|
#include "trs/trs.hpp"
|
||
|
#include "trs/utils/var.hpp"
|
||
|
|
||
|
namespace worckspaces
|
||
|
{
|
||
|
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";
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
auto main(int argc, char* args[]) -> int
|
||
|
{
|
||
|
trs::http app;
|
||
|
app.register_function("healthcheck", worckspaces::provider);
|
||
|
app.register_inspector("healthcheck", worckspaces::inspector);
|
||
|
|
||
|
app.init("app_connection", "log_connection");
|
||
|
app.run();
|
||
|
}
|