torus_http/lib.rs
1//! # toy-rusttp
2//!
3//! A small, synchronous http server library with a surprisingly pleasant
4//! developer experience and minimal moving parts.
5//!
6//! ## Example usage:
7//!
8//! ```rust
9//! use toy_rusttp::prelude::*;
10//!
11//! fn main() {
12//! let server: HttpServer<_> = HttpServer::new(("127.0.0.1", 8080))
13//! .get("/", hello_world)
14//! .route(
15//! "/hello",
16//! HttpMethod::Other("custom".into()),
17//! |_| "hello from a custom method",
18//! )
19//! .add_middleware(|req| {
20//! println!("got request: {req:#?}");
21//! req
22//! });
23//!
24//! _ = server.run();
25//! }
26//!
27//! pub fn hello_world(req: Request) -> impl Response {
28//! format!(
29//! "hello, kind world... I will now proceed to print your headers: {:#?}",
30//! req.headers
31//! )
32//! }
33//! ```
34
35pub mod method;
36pub mod prelude;
37pub mod request;
38pub mod response;
39pub mod server;
40pub mod status;