An easy-to-understand HTTP Web Server for all the Windows users that want to work with C++ and learn about how to build an HTTP Web Server from scratch.
I wanted to build an HTTP Web server from scratch because:
- Wanted to learn how to build one from scratch.
- Didn't find a good reference project that did it for
Windows. - Implement socket programming in
C++.
http-server-cpp/
├── CMakeLists.txt
├── README.md
├── build/ # Build output directory
├── include/ # Header files
│ ├── http/ # HTTP-related headers
│ │ ├── HttpRequest.h
│ │ ├── HttpResponse.h
│ │ ├── HttpParser.h
│ │ └── HttpFormatter.h
│ └── server/ # Server-related headers
│ │ ├── Server.h
│ │ └── Router.h
| └── utils/ # Utility-related headers
│ └── TodoStorage.h
├── src/ # Source files
│ ├── http/ # HTTP implementation
│ │ ├── HttpRequest.cpp
│ │ ├── HttpResponse.cpp
│ │ ├── HttpParser.cpp
│ │ └── HttpFormatter.cpp
│ ├── server/ # Server implementation
│ │ ├── Server.cpp
│ │ └── Router.cpp
│ ├── utils/
| | └── TodoStorage.cpp # For CRUD
│ └── main.cpp # Application entry point
└── pages/ # Static web content
├── index.html
├── about.html
└── todo.html- Install CMake
- Install C++ - Reference Documentation
- Make sure you have Ws2_32.lib library files
$ git clone https://github.com/rathink4/http-server-cpp.git
$ cd http-server-cpp
Create the build directory and navigate into it:
$ mkdir build
$ cd build
Run CMake to configure the project
$ cmake ..
Build the application
$ cmake --build .
$ cd bin
$ ./HttpServerCpp
- Document the README.md file.
- Implement TCP Server-Client connection.
- Implement HTTP Server-Client connection.
- Refactored code for extensibility
- Add GET, POST, PUT, DELETE functionality in the web server.
- Handle multiple client connections requests.