#include "pihttpserver.h" #include "pip.h" using namespace PICoutManipulators; PIKbdListener kbd; const char * pageTitle = "" "" "
" "arg=%1
"_a.arg(r.args.value("a0")).toUTF8()); return ret; }); server.registerPath("/api", [](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody(PIByteArray::fromAscii("API")); return ret; }); server.registerPath("/api/*", [](const MicrohttpdServer::Request & r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply ret; ret.setBody("API etry %1"_a.arg(r.path).toUTF8()); ret.setCode(405); return ret; }); /*server.setRequestCallback([](MicrohttpdServer::Request r) -> MicrohttpdServer::Reply { MicrohttpdServer::Reply rep; piCout << "request" << r.path; piCout << " header" << r.headers; piCout << " args" << r.args; piCout << " body" << r.body; piCout << ""; rep.setBody(PIByteArray::fromAscii("[{\"value1\": true, \"value2\": \"ыекштп\"}]")); return rep; });*/ piCout << "start" << server.isListen(); WAIT_FOR_EXIT server.stop(); return 0; }