C++ HTTP server that serves static files, provides a simple JSON API, and handles multiple clients concurrently using multithreading.
- g++-13
- jsoncpp (libjsoncpp-dev)
-
Install dependencies:
sudo apt update sudo apt install -y build-essential g++-13 libjsoncpp-dev
-
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git cd your-repo-name
-
Compile the server:
g++-13 -std=c++11 -pthread -ljsoncpp http_server.cpp -o http_server
-
Run the server:
./http_server
- Visit
http://localhost:8080/
to view the homepage. - Visit
http://localhost:8080/api
to get a JSON response.