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 cookies;
40pub mod error;
41pub mod handler;
42#[cfg(feature = "jwt")]
43pub mod jwt;
44pub mod middleware;
45pub mod openapi;
46pub mod rate_limit;
47pub mod request;
48pub mod response;
49pub mod router;
50pub mod security;
51pub mod static_files;
52pub mod template;
53#[cfg(feature = "websocket")]
54pub mod websocket;
55
56pub mod prelude {
57 pub use crate::app::{App, RouteGroup};
58 pub use crate::cookies::{Cookie, Cookies};
59 pub use crate::error::{Error, Result};
60 pub use crate::handler::Handler;
61 pub use crate::middleware::{Middleware, Next};
62 pub use crate::request::{Params, Query, Request};
63 pub use crate::response::{Json, Response};
64 pub use crate::router::Router;
65 pub use crate::template::{TemplateEngine, Templates};
66 pub use async_trait::async_trait;
67 pub use serde::{Deserialize, Serialize};
68}