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 negotiate;
58pub mod observability;
59pub mod openapi;
60pub mod problem;
61pub mod rate_limit;
62pub mod request;
63pub mod response;
64pub mod router;
65pub mod secure;
66pub mod security;
67pub mod security_headers;
68pub mod session;
69pub mod shutdown;
70pub mod sse;
71pub mod static_files;
72pub mod stream;
73pub mod template;
74pub mod testing;
75#[cfg(feature = "tls")]
76pub mod tls;
77pub mod trace;
78pub mod upload;
79pub mod validate;
80#[cfg(feature = "websocket")]
81pub mod websocket;
82
83pub mod prelude {
84    pub use crate::app::{App, RouteGroup};
85    pub use crate::cookies::{Cookie, Cookies};
86    pub use crate::error::{Error, Result};
87    pub use crate::handler::Handler;
88    pub use crate::middleware::{Middleware, Next};
89    pub use crate::request::{Params, Query, Request};
90    pub use crate::response::{Json, Response};
91    pub use crate::router::Router;
92    pub use crate::shutdown::{Context, Shutdown};
93    pub use crate::template::{TemplateEngine, Templates};
94    pub use async_trait::async_trait;
95    pub use serde::{Deserialize, Serialize};
96}