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.
- 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 startrps: requests per second
- Modular code structure:
server.rs→ manages server lifecycleroutes.rs→ defines HTTP routesstats.rs→ tracks server statistics
- Built on Tokio and Hyper for asynchronous performance
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
- Rust (latest stable version recommended)
- Cargo build system
- Linux, macOS, or Windows
make buildmake runThe server will start by default at: http://127.0.0.1:8080
-
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 }
- Format code:
make fmt
- Run linter:
make check
- Run tests:
make test
This project is licensed under the MIT License.
You are free to use, modify, and distribute it under the terms of the license.