Skip to content

A lightweight, high-performance HTTP server written in Rust. This project is built using Tokio and Hyper for asynchronous performance and is structured in a modular way for maintainability.

Notifications You must be signed in to change notification settings

VryptLab/rust-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Performance HTTP Server in Rust

This project is a lightweight and high-performance HTTP server written in Rust.
It is designed with modular structure, concurrency, and real-time statistics tracking.


Features

  • Lightweight and minimal dependencies
  • Fast response for core endpoints:
    • GET / → returns "OK"
    • GET /stats → returns JSON with real-time statistics:
      • total_connections: number of requests since server start
      • rps: requests per second
  • Modular code structure:
    • server.rs → manages server lifecycle
    • routes.rs → defines HTTP routes
    • stats.rs → tracks server statistics
  • Built on Tokio and Hyper for asynchronous performance

Project Structure

src/
├─ main.rs       # Entry point
├─ server.rs     # HTTP server logic
├─ routes.rs     # Routing and responses
└─ stats.rs      # Real-time statistics
Cargo.toml       # Project configuration
Makefile         # Build and utility commands

Requirements

  • Rust (latest stable version recommended)
  • Cargo build system
  • Linux, macOS, or Windows

Build and Run

Build

make build

Run

make run

The server will start by default at: http://127.0.0.1:8080


Usage

  • Root endpoint:

    curl http://127.0.0.1:8080/

    Response:

    OK
    
  • Statistics endpoint:

    curl http://127.0.0.1:8080/stats

    Example response:

    {
      "total_connections": 42,
      "rps": 7
    }

Development

  • Format code:
    make fmt
  • Run linter:
    make check
  • Run tests:
    make test

License

This project is licensed under the MIT License.
You are free to use, modify, and distribute it under the terms of the license.

About

A lightweight, high-performance HTTP server written in Rust. This project is built using Tokio and Hyper for asynchronous performance and is structured in a modular way for maintainability.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published