Basic HTTP Server that serves static html files, with basic routing implemented, along with basic multithreading.
- Multiple Connections
- Static File Serving
- Logging
I have already compiled the executable which is placed in ./src/windows/WindowsServer.exe
. Simply launch the application to get started, and you will be prompted to open https://localhost:8080
. Simply hold down the key and left click the link to launch your default browser to the specified address. Assuming the server is still open and you've navigated to the correct address, you should be looking at a static HTML page that contains the links. If you click on the links, it sends a request to the server, which is printed both in its raw form, and a parsed format. Once the request is received and printed, the server sends a response containing the HTML page which has been loaded from the local storage on the server and sent in an HTTP response, which is then parsed by the browser, and then responds by displaying the content received.
Before attempting to compile, ensure you have the following dependencies:
- Operating System: Windows
- C++ Compiler: Microsoft Visual Studio OR Developer Powershell for VS 2022 (What I use for compiling with VSCode)
- CMake
- Build Tool: NMake
git clone https://github.com/noah-tah/cpp-http-server.git
cmake --version
cl
nmake
- Nativigate to root of project directory
cd C:\path\to\cpp-http-server`
mkdir build
cd build
cmake .. -G "NMake Makefiles"
nmake
.\server.exe
or
explorer.exe .
Then click on the executable.