#web-server #async #server

bin+lib httpageboy

A lightweight library for handling raw HTTP request/response transmission. Good base for APIs. Supports both synchronous and asynchronous programming models.

11 stable releases

Uses new Rust 2024

1.0.13 Oct 4, 2025
1.0.12 Sep 24, 2025
1.0.11 Jul 19, 2025
1.0.7 Jun 27, 2025
0.1.0 Jul 11, 2025

#305 in HTTP server

Download history 275/week @ 2025-06-25 2/week @ 2025-07-02 241/week @ 2025-07-09 337/week @ 2025-07-16 49/week @ 2025-07-23 140/week @ 2025-09-24 132/week @ 2025-10-01 47/week @ 2025-10-08

319 downloads per month

MIT license

61KB
1.5K SLoC

HTTPageboy

Minimal HTTP server package for handling request/response transmission. Focuses only on transporting a well formed HTTP message; does not process or decide how the server behaves. Aspires to become runtime-agnostic, with minimal, solid, and flexible dependencies.

Example

The core logic resides in src/lib.rs.

See it working out of the box on this video

The following example is executable. Run cargo run to see the available variants and navigate to http://127.0.0.1:7878 in your browser.

A basic server setup:

#![cfg(feature = "async_tokio")]
use httpageboy::{Rt, Response, Server, StatusCode};

/// Minimal async handler: waits 100ms and replies "ok"
async fn demo(_req: &()) -> Response {
  tokio::time::sleep(std::time::Duration::from_millis(100)).await;
  Response {
    status: StatusCode::Ok.to_string(),
    content_type: "text/plain".into(),
    content: b"ok".to_vec(),
  }
}

#[tokio::main]
async fn main() {
  let mut srv = Server::new("127.0.0.1:7878", None).await.unwrap();
  srv.add_route("/", Rt::GET, handler!(demo));
  srv.run().await;
}

Testing

For synchronous tests:

cargo test --features sync --test test_sync

For asynchronous tests:

cargo test --features async_tokio --test test_async_tokio
cargo test --features async_std --test test_async_std
// or
cargo test --features async_smol --test test_async_smol

Examples

Additional examples can be found within the tests.

License

Copyright (c) 2025 fahedsl. This project is licensed under the MIT License.

Dependencies

~0.8–15MB
~153K SLoC