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 ember;
32pub mod error_pages;
33pub mod extractors;
34pub mod handler;
35pub mod macros;
36pub mod middleware;
37pub mod production;
38pub mod request;
39pub mod response;
40pub mod router;
41pub mod security;
42pub mod server;
43pub mod websocket;
44
45// Everything you need to get started
46pub use app::App;
47pub use error_pages::ErrorPages;
48pub use handler::{Handler, HandlerFn};
49pub use request::Request;
50pub use response::Response;
51pub use router::Router;
52
53// HTTP essentials from the http crate
54pub use http::{Method, StatusCode, HeaderMap, HeaderName, HeaderValue};
55
56// Re-export tokio main macro for convenience
57pub use tokio::main;
58
59#[cfg(feature = "json")]
60pub use serde_json::{json, Value as JsonValue};