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 Development and Documentation
- app
- Application Builder
- cache
- High-Performance Caching
- config
- Configuration system for Torch framework
- database
- Database Integration
- ember
- Ember Template Engine
- error_
pages - extractors
- Request Extractors
- handler
- macros
- Torch Compile-Time Route Registration
- middleware
- Middleware System
- production
- Production-Ready Features
- request
- HTTP Request Handling
- response
- HTTP Response Building
- router
- HTTP Router
- security
- Security Middleware and Utilities
- server
- websocket
- WebSocket Support for Real-Time Applications
Macros§
- delete
- get
- Attribute macro for route registration (placeholder for proc macro)
- handler
- A convenience macro for creating simple handlers
- json
- Construct a
serde_json::Value
from a JSON literal. - post
- put
- route_
table - Macro for generating compile-time route tables
- routes
- Compile-time route registration macro
- torch_
handler - Macro for generating type-safe route handlers
Structs§
- Header
Map - A set of HTTP headers
- Header
Name - Represents an HTTP header field name
- Header
Value - Represents an HTTP header field value.
- Method
- The Request Method (VERB)
- Status
Code - An HTTP status code (
status-code
in RFC 9110 et al.).
Enums§
- Json
Value - Represents any valid JSON value.