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//! | `signing` | `ullun::signed_cookies` - HMAC-signed cookies |
29//! | `encryption` | `ullun::private_cookies` - encrypted cookies |
30//! | `jwt` | `ullun::jwt` - HS256 tokens and bearer-auth middleware |
31//! | `jwt-asymmetric` | `ullun::jwt_keys` - RS256 / ES256 tokens and JWKS |
32//! | `redis` | `ullun::redis` - Redis client and shared stores for sessions, rate limits and idempotency keys |
33//! | `compression` | `ullun::compression` - gzip middleware |
34//! | `websocket` | `App::ws` and `ullun::websocket` |
35//! | `full` | all of the above |
36//!
37//! Always available: [`rate_limit`], [`openapi`], [`template`], form parsing
38//! (`Request::form`) and group-level middleware.
39
40#![forbid(unsafe_code)]
41
42pub mod app;
43pub mod auth;
44pub mod cache;
45pub mod client;
46#[cfg(feature = "compression")]
47pub mod compression;
48pub mod conditional;
49pub mod cookies;
50pub mod cors;
51pub mod csrf;
52pub mod error;
53pub mod files;
54pub mod handler;
55pub mod health;
56pub mod hub;
57pub mod idempotency;
58pub mod jobs;
59#[cfg(feature = "jwt")]
60pub mod jwt;
61#[cfg(feature = "jwt-asymmetric")]
62pub mod jwt_keys;
63pub mod limits;
64pub mod middleware;
65pub mod multipart;
66pub mod negotiate;
67pub mod observability;
68pub mod openapi;
69#[cfg(feature = "encryption")]
70pub mod private_cookies;
71pub mod problem;
72pub mod proxy;
73pub mod rate_limit;
74#[cfg(feature = "redis")]
75pub mod redis;
76pub mod request;
77pub mod response;
78pub mod router;
79pub mod secure;
80pub mod security;
81pub mod security_headers;
82pub mod session;
83pub mod shutdown;
84#[cfg(feature = "signing")]
85pub mod signed_cookies;
86pub mod sse;
87pub mod static_files;
88pub mod stream;
89pub mod template;
90pub mod testing;
91#[cfg(feature = "tls")]
92pub mod tls;
93pub mod trace;
94pub mod upload;
95pub mod validate;
96#[cfg(feature = "websocket")]
97pub mod websocket;
98
99pub mod prelude {
100    pub use crate::app::{App, RouteGroup};
101    pub use crate::cookies::{Cookie, Cookies};
102    pub use crate::error::{Error, Result};
103    pub use crate::handler::Handler;
104    pub use crate::middleware::{Middleware, Next};
105    pub use crate::request::{Params, Query, Request};
106    pub use crate::response::{Json, Response};
107    pub use crate::router::Router;
108    pub use crate::shutdown::{Context, Shutdown};
109    pub use crate::template::{TemplateEngine, Templates};
110    pub use async_trait::async_trait;
111    pub use serde::{Deserialize, Serialize};
112}