https://github.com/cachebag/rust-line
HTTP server built in Rust from scratch, for educational purposes.
https://github.com/cachebag/rust-line
Last synced: 2 months ago
JSON representation
HTTP server built in Rust from scratch, for educational purposes.
- Host: GitHub
- URL: https://github.com/cachebag/rust-line
- Owner: cachebag
- Created: 2025-07-24T13:44:10.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-09-09T03:25:34.000Z (7 months ago)
- Last Synced: 2025-09-09T06:24:39.768Z (7 months ago)
- Language: Rust
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rust-line
A minimal HTTP server built from scratch in Rust
## Endpoints
- `GET /ping` – returns `PONG`.
- `GET /uptime` – returns server uptime.
- `GET /echo/` – echoes `` back.
- `GET /user-agent` – returns the `User-Agent` header from the request.
- `GET /files` - Returns content of a specified file
## Performance (WIP)
`perf.sh` will use `wrk` to run a performance test on the server. It runs 250 connections on 10 threads. It serves `index.html`.
```bash
chmod +x perf.sh
./perf.sh
```
#### Current Benchmarks (may vary based on your machine's specs):
- ~100,000+ requests/second
- ~2.4ms average response time
- Tests 250 concurrent connections on 10 threads
- Throughout -> 6.8MB/s

###### **Device Specs**:

## Run
No directory specified
```bash
cargo run --release -- ns
````
Set cwd
```bash
cargo run --release -- directory /path/to/dir
````
Default cwd to `.`
```bash
cargo run --release -- directory
````
## Test (WIP)
**Integration Tests**
```bash
cargo test --test load_test -- --nocapture
```
**Unit Tests**
```bash
cargo test --lib
```
**Everything**
```bash
cargo test
```