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