Skip to content

ius99/cpp-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

C++ HTTP Server

A lightweight HTTP server implemented in C++ that handles basic HTTP requests. This server is designed to be simple, efficient, and easy to extend.

Features

  • Simple HTTP server that runs on localhost
  • Handles basic HTTP GET requests
  • Configurable port
  • Basic error handling and logging
  • Clean, modular code structure

Prerequisites

  • C++ compiler (tested with GCC/G++ 6.3.0)
  • Git
  • Windows, Linux, or macOS

Project Structure

cpp-http-server/
├── build/          # Build outputs and artifacts
├── include/        # Header files
├── src/            # Source files
│   └── main.cpp    # Main program entry point
├── .gitignore      # Git ignore file
└── README.md       # This README

Building the Project

  1. Clone the repository:

    git clone https://github.com/yourusername/cpp-http-server.git
    cd cpp-http-server
    
  2. Compile the project:

    g++ -o build/server src/main.cpp -std=c++11
    

Running the Server

  1. Start the server:

    ./build/server
    

    On Windows:

    build\server.exe
    
  2. The server will start on localhost (127.0.0.1) port 8080 by default.

  3. Test the server by opening a web browser and navigating to:

    http://localhost:8080
    

    Or using curl:

    curl http://localhost:8080
    

Configuration

You can modify the port by changing the PORT constant in the source code.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages