Expand description
desirable - A minimal and pragmatic Rust web application framework.
This crate provides a lightweight HTTP server framework built on top of hyper. It is inspired by axum, tide, and tinyweb.
§Quick Start
ⓘ
use desirable::{Router, Result};
use std::env;
#[tokio::main]
async fn main() -> Result<()> {
let mut router = Router::new();
router.get("/", || async { "Hello, World!" });
let addr = env::args()
.nth(1)
.unwrap_or_else(|| "127.0.0.1:3000".to_string());
desirable::new(&addr).run(router).await
}§Features
- Router - HTTP method routing with path parameter support
- Middleware - composable middleware stack
- Request/Response - ergonomic HTTP types
- Static Files - file and directory serving
- Async/Await - fully asynchronous throughout
Re-exports§
pub use error::Error;pub use fs::ServeDir;pub use fs::ServeFile;pub use into_response::IntoResponse;pub use kernel::DynEndpoint;pub use kernel::Endpoint;pub use kernel::Middleware;pub use kernel::Next;pub use request::Request;pub use response::Response;pub use router::Router;pub use server::Server;pub use session::Session;pub use session::SessionConfig;pub use session::SessionError;pub use session::SessionManager;pub use types::AnyResult;pub use types::HyperRequest;pub use types::HyperResponse;pub use types::Result;pub use hyper::http;
Modules§
- body
- Streaming bodies for Requests and Responses
- error
- fs
- header
- HTTP header types
- into_
response - kernel
- request
- response
- router
- server
- session
- Cookie-based session management for the desirable web framework.
- types
- utils