Skip to content

This Rust program implements a lightweight HTTP server entirely from scratch, without relying on external dependencies. It listens for incoming connections on port 8080 and responds to HTTP requests, supporting basic GET and POST methods. The server is capable of serving static files such as HTML, CSS, and JavaScript.

Notifications You must be signed in to change notification settings

Authtbh/http-from-scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight HTTP Server in Rust

This project implements a simple HTTP server written entirely in Rust.

Features:

  • Lightweight: No external dependencies required.
  • Customizable: Build upon this foundation for your specific needs.
  • Basic Functionality:
    • Listens on port 8080.
    • Supports GET and POST methods.
    • Serves static files (HTML, CSS, JS).
    • Echos POST request bodies back for the /echo endpoint.
    • Returns 404 Not Found for missing resources.

Benefits:

  • Learn Rust by Example: Understand the fundamentals of building an HTTP server.
  • Simple Starting Point: Build upon this codebase for your web applications.

Getting Started:

  1. Clone the repository: git clone https://https://github.com/Authtbh/http-from-scratch
  2. Build the project: cargo build
  3. Run the server: cargo run

This server is intended for educational purposes and is not production-ready.

Further Development:

This implementation provides a basic framework. You can extend it to include features like:

  • User authentication and authorization
  • Session management
  • Routing for complex URLs
  • Database integration

Feel free to explore and customize this codebase to suit your requirements!

About

This Rust program implements a lightweight HTTP server entirely from scratch, without relying on external dependencies. It listens for incoming connections on port 8080 and responds to HTTP requests, supporting basic GET and POST methods. The server is capable of serving static files such as HTML, CSS, and JavaScript.

Resources

Stars

Watchers

Forks

Packages

No packages published