#include "bs_util.h" using namespace std; int main() { Request req; Session se(req); Response res; json j; auto jsonfail=[&](int errcode,const std::string& dtl="") { jsonfail_func(j,errcode,dtl); }; do { if(!se.isReady()) { jsonfail(err_session); break; } if(req.requestMethod!="POST") { jsonfail(err_method_not_supported); break; } startdb(); } while(0); se.writeToResponse(res); res.content.append(j.dump()); return 0; }