roschuma wrote:
Here's a simple one-file example:Thanks. That is for GET. Can you also how me an example for POST?#include <iostream> #include <cpprest/http_listener.h> using namespace web::http::experimental::listener; using namespace web::http; int main() { uri_builder uri(L"http://localhost:2001/"); http_listener listener(uri.to_uri()); listener.support(methods::GET, [](http_request req) { std::cout << "Serving GET" << std::endl; req.reply(status_codes::OK, U("<html><body><h1>It works!</h1>(Casablanca, that is.)</body></html>"), U("text/html")); }); listener.open().wait(); fgetc(stdin); listener.close().wait(); return 0; }