Skip to content

This is my first time implementing HTTP protocols, doing it in C++ for use as my final project in my C++ class

Notifications You must be signed in to change notification settings

noah-tah/cpp-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ HTTP Server (Windows)

Overview

Basic HTTP Server that serves static html files, with basic routing implemented, along with basic multithreading.

Features

  • Multiple Connections
  • Static File Serving
  • Logging

Just want to run the program

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.

Steps to compile this thing from source

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

Steps to compile

0. Clone the repo if you wanted

git clone https://github.com/noah-tah/cpp-http-server.git

1. Verify Dependencies

cmake --version
cl
nmake

2. Open Developer Command Prompt for VS

  • Nativigate to root of project directory
cd C:\path\to\cpp-http-server`

3. Make a build directory

mkdir build
cd build

4. Generate Build Files with CMake

cmake .. -G "NMake Makefiles"

5. Compile project

nmake

6. Run the Project

.\server.exe

or

explorer.exe .

Then click on the executable.

About

This is my first time implementing HTTP protocols, doing it in C++ for use as my final project in my C++ class

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published