Expand description
§Torch Web Framework
A fast, secure web framework that gets out of your way. Built for developers who need production-ready features without the complexity.
§Quick Start
use torch_web::{App, Request, Response};
#[tokio::main]
async fn main() {
    let app = App::new()
        .get("/", |_req: Request| async {
            Response::ok().body("Hello, World!")
        })
        .get("/users/:id", |req: Request| async move {
            let id = req.param("id").unwrap();
            Response::ok().body(format!("User ID: {}", id))
        });
    app.listen("127.0.0.1:3000").await.unwrap();
}Re-exports§
- pub use app::App;
- pub use error_pages::ErrorPages;
- pub use handler::Handler;
- pub use handler::HandlerFn;
- pub use request::Request;
- pub use response::Response;
- pub use router::Router;
Modules§
- api
- API versioning, documentation, and OpenAPI support
- app
- cache
- High-performance caching with Redis and in-memory support
- config
- Configuration system for Torch framework
- database
- Database integration with connection pooling and query builder
- error_pages 
- extractors
- Extractors
- handler
- middleware
- production
- Production-ready features for high-scale applications
- request
- response
- router
- security
- Security middleware and utilities for Torch framework
- server
- websocket
- WebSocket support for real-time applications
Macros§
- handler
- A convenience macro for creating simple handlers
- json
- Construct a serde_json::Valuefrom a JSON literal.
Structs§
- HeaderMap 
- A set of HTTP headers
- HeaderName 
- Represents an HTTP header field name
- HeaderValue 
- Represents an HTTP header field value.
- Method
- The Request Method (VERB)
- StatusCode 
- An HTTP status code (status-codein RFC 9110 et al.).
Enums§
- JsonValue 
- Represents any valid JSON value.