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 cors;
42pub mod csrf;
43pub mod error;
44pub mod files;
45pub mod handler;
46pub mod hub;
47pub mod idempotency;
48pub mod jobs;
49#[cfg(feature = "jwt")]
50pub mod jwt;
51pub mod limits;
52pub mod middleware;
53pub mod multipart;
54pub mod observability;
55pub mod openapi;
56pub mod rate_limit;
57pub mod request;
58pub mod response;
59pub mod router;
60pub mod secure;
61pub mod security;
62pub mod security_headers;
63pub mod session;
64pub mod shutdown;
65pub mod sse;
66pub mod static_files;
67pub mod stream;
68pub mod template;
69#[cfg(feature = "tls")]
70pub mod tls;
71pub mod validate;
72#[cfg(feature = "websocket")]
73pub mod websocket;
74
75pub mod prelude {
76    pub use crate::app::{App, RouteGroup};
77    pub use crate::cookies::{Cookie, Cookies};
78    pub use crate::error::{Error, Result};
79    pub use crate::handler::Handler;
80    pub use crate::middleware::{Middleware, Next};
81    pub use crate::request::{Params, Query, Request};
82    pub use crate::response::{Json, Response};
83    pub use crate::router::Router;
84    pub use crate::shutdown::{Context, Shutdown};
85    pub use crate::template::{TemplateEngine, Templates};
86    pub use async_trait::async_trait;
87    pub use serde::{Deserialize, Serialize};
88}