A simple multithread async http server based on asio
using namespace http::server;
server s("127.0.0.1", "8080", 1);
s.add_handler("/hello", [](const request &req) {
reply rep;
rep.content = "hello world!";
rep.status = reply::ok;
rep.headers["Content-Length"] = std::to_string(rep.content.size());
rep.headers["Content-Type"] = "text/plain";
return rep;
});
// Run the server until stopped.
s.run();
See example/main.cpp
for a complete example
mkdir build && cd build
cmake .. -DBUILD_EXAMPLE -DCMAKE_BUILD_TYPE=Release
MIT License
Based on the examples from asio licensed by Boost License.