torch_web/lib.rs
1//! # Torch Web Framework
2//!
3//! A fast, secure web framework that gets out of your way. Built for developers who need
4//! production-ready features without the complexity.
5//!
6//! ## Quick Start
7//!
8//! ```rust,no_run
9//! use torch_web::{App, Request, Response};
10//!
11//! #[tokio::main]
12//! async fn main() {
13//! let app = App::new()
14//! .get("/", |_req: Request| async {
15//! Response::ok().body("Hello, World!")
16//! })
17//! .get("/users/:id", |req: Request| async move {
18//! let id = req.param("id").unwrap();
19//! Response::ok().body(format!("User ID: {}", id))
20//! });
21//!
22//! app.listen("127.0.0.1:3000").await.unwrap();
23//! }
24//! ```
25
26pub mod api;
27pub mod app;
28pub mod cache;
29pub mod config;
30pub mod database;
31pub mod error_pages;
32pub mod handler;
33pub mod middleware;
34pub mod production;
35pub mod request;
36pub mod response;
37pub mod router;
38pub mod security;
39pub mod server;
40pub mod websocket;
41
42// Everything you need to get started
43pub use app::App;
44pub use error_pages::ErrorPages;
45pub use handler::{Handler, HandlerFn};
46pub use request::Request;
47pub use response::Response;
48pub use router::Router;
49
50// HTTP essentials from the http crate
51pub use http::{Method, StatusCode, HeaderMap, HeaderName, HeaderValue};
52
53// Re-export tokio main macro for convenience
54pub use tokio::main;
55
56#[cfg(feature = "json")]
57pub use serde_json::{json, Value as JsonValue};