Initial commit
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
//! # urus — a cowboy/bandit-style HTTP library for the smarm actor runtime.
|
||||
//!
|
||||
//! v1 covers HTTP/1.1, the plug pipeline, and a built-in router. See
|
||||
//! `urus-spec.md` for the design.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! use urus::{Pipeline, Router, Conn, Next, serve};
|
||||
//!
|
||||
//! let pipeline = Pipeline::new().plug(
|
||||
//! Router::new()
|
||||
//! .get("/", |c: Conn, _n: Next| c.put_status(200).put_body("hello"))
|
||||
//! .get("/users/:id", |c: Conn, _n: Next| {
|
||||
//! let id = c.params.get("id").unwrap_or("").to_string();
|
||||
//! c.put_status(200).put_body(id)
|
||||
//! })
|
||||
//! );
|
||||
//!
|
||||
//! serve("0.0.0.0:8080", pipeline).unwrap();
|
||||
//! ```
|
||||
|
||||
pub mod conn;
|
||||
pub mod plug;
|
||||
pub mod router;
|
||||
pub mod parser;
|
||||
pub mod net;
|
||||
pub mod conn_actor;
|
||||
pub mod serve;
|
||||
|
||||
// Re-exports — what most users want at the crate root.
|
||||
pub use conn::{Assigns, Body, Conn, HeaderMap, HttpVersion, Method, Params, RespBody};
|
||||
pub use plug::{Next, Pipeline, Plug};
|
||||
pub use router::Router;
|
||||
pub use serve::{serve, serve_with, Config};
|
||||
Reference in New Issue
Block a user