Skip to content

rathink4/http-server-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTP Web Server in Windows using C++

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.



Contents

Why?

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++.

Project Structure

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

Prerequisites


  1. Install CMake
  2. Install C++ - Reference Documentation
  3. Make sure you have Ws2_32.lib library files

Installation


Step 1: Clone the Repo

$ git clone https://github.com/rathink4/http-server-cpp.git
$ cd http-server-cpp

Step 2: Build the Project

Create the build directory and navigate into it:

$ mkdir build
$ cd build

Run CMake to configure the project

$ cmake ..

Build the application

$ cmake --build .

Step 3: Run the server

$ cd bin
$ ./HttpServerCpp

TODO


  • 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.

About

Coding project to implement http server from scratch in C++.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors