Standard C++ HTTP Server is a lightweight, multithreaded HTTP server built using minimal libraries.
- Listens on port 3000 by default.
- Serves static files from the
/public
directory. - Efficient routing of HTTP requests.
- Multithreaded design for handling multiple connections.
- Automatic headers management for optimal browser support.
- Windows (using WinSock)
- Linux (using POSIX sockets)
- A C++ 23 compliant compiler.
- CMake version 3.10 or later.
- For Windows targets, g++ version 14 or later.
- An Internet connection (needed to fetch dependencies).
mkdir build
cd build
cmake ..
cmake --build .
-
On Linux:
./server [port] [publicDir]
-
On Windows:
server.exe [port] [publicDir]
- GET
/hello
Returns an HTML message with "Hello World!".
Place your static files inside the /public
directory. The server automatically maps:
- Direct file requests (e.g.,
/index.html
). - Directory requests, if an
index.html
exists in a subdirectory.
- C++ 23 Standard Library.
- nlohmann/json for JSON parsing.
- OpenSSL