This library contains the implementation of HTTP in C++ inspired by NodeJS HTTP module. It is tempting bo be easy in use (like NodeJS one does) and extensible. The current roadmap only includes expresscpp module implementation, which, as you might have guessed, will be based on NodeJS Express module
This library contains only headers. But an additional third-party library sockpp is required when building your application or library.
You should just include <http.h> header and start using it. Here is
a very simple example of its usage:
#include <http.h>
#include <thread>
using namespace events;
using namespace http;
int main()
{
server svr;
bool finished;
svr.on_request += [&finished](incoming_message& req, server_response& res) {
res.end("Hello world");
finished = true;
};
svr.listen();
while (!finished)
std::this_thread::sleep_for(std::chrono::milliseconds(200));
svr.close();
return 0;
}I try to keep the interface of the library very close to the one existing on NodeJS. So, anybody with knowledge in NodeJS HTTP can easily understand this library and vice-versa.