Skip to main content

ullun/
lib.rs

1//! # ullun-api
2//!
3//! Express.js-inspired web framework for Rust.
4//!
5//! ## Quick Start
6//!
7//! ```no_run
8//! use ullun::prelude::*;
9//!
10//! #[tokio::main]
11//! async fn main() {
12//!     App::new()
13//!         .get_with_params("/hello/{name}", |params: Params| async move {
14//!             Ok(Response::json(serde_json::json!({
15//!                 "message": format!("Hello, {}!", params.get("name").unwrap())
16//!             })))
17//!         })
18//!         .run("127.0.0.1:3000")
19//!         .await
20//!         .unwrap();
21//! }
22//! ```
23
24//! ## Optional features
25//!
26//! | Feature | Adds |
27//! |---------|------|
28//! | `jwt` | `ullun::jwt` - HS256 tokens and bearer-auth middleware |
29//! | `compression` | `ullun::compression` - gzip middleware |
30//! | `websocket` | `App::ws` and `ullun::websocket` |
31//! | `full` | all of the above |
32//!
33//! Always available: [`rate_limit`], [`openapi`], [`template`], form parsing
34//! (`Request::form`) and group-level middleware.
35
36pub mod app;
37#[cfg(feature = "compression")]
38pub mod compression;
39pub mod conditional;
40pub mod cookies;
41pub mod csrf;
42pub mod error;
43pub mod files;
44pub mod handler;
45#[cfg(feature = "jwt")]
46pub mod jwt;
47pub mod middleware;
48pub mod multipart;
49pub mod openapi;
50pub mod rate_limit;
51pub mod request;
52pub mod response;
53pub mod router;
54pub mod security;
55pub mod session;
56pub mod shutdown;
57pub mod sse;
58pub mod static_files;
59pub mod stream;
60pub mod template;
61pub mod validate;
62#[cfg(feature = "websocket")]
63pub mod websocket;
64
65pub mod prelude {
66    pub use crate::app::{App, RouteGroup};
67    pub use crate::cookies::{Cookie, Cookies};
68    pub use crate::error::{Error, Result};
69    pub use crate::handler::Handler;
70    pub use crate::middleware::{Middleware, Next};
71    pub use crate::request::{Params, Query, Request};
72    pub use crate::response::{Json, Response};
73    pub use crate::router::Router;
74    pub use crate::shutdown::{Context, Shutdown};
75    pub use crate::template::{TemplateEngine, Templates};
76    pub use async_trait::async_trait;
77    pub use serde::{Deserialize, Serialize};
78}