Simple C++ HTTP Server

Feature list

  • Multiple paths
  • 404 page
  • No extra HTTP libraries
  • Multiple clients
  • GET, POST, HEAD, DELETE, OPTIONS, PATCH, PUT
  • Live memory view
  • Request logging
  • MD5 Hash generator
  • C++ Templating engine for HTML
  • HTTPs support
  • Rate limit system

How to compile

gcc server.cpp md5.cpp -o server.exe -lws2_32 -lstdc++ -Os

Example route

// Example route for /example with GET
if (app.get("/example", path, method)) {
    html += "<h1>C++ Server /example page</h1>";
    html += "<p>Hello, world!</p>";
    content_type = "text/html\r\n";
}

Example logs

[SERVER] 127.0.0.1 GET /memory HTTP/1.1
[SERVER] 127.0.0.1 GET / HTTP/1.1
[SERVER] 127.0.0.1 POST /md5 HTTP/1.

C++ – JS Express

Screenshot

Contributing

Found a bug or problem? File an issue or submit a pull request with the fix.

GitHub

View Github