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