Skip to main content

Crate ullun

Crate ullun 

Source
Expand description

§ullun-api

Express.js-inspired web framework for Rust.

§Quick Start

use ullun::prelude::*;

#[tokio::main]
async fn main() {
    App::new()
        .get_with_params("/hello/{name}", |params: Params| async move {
            Ok(Response::json(serde_json::json!({
                "message": format!("Hello, {}!", params.get("name").unwrap())
            })))
        })
        .run("127.0.0.1:3000")
        .await
        .unwrap();
}

§Optional features

FeatureAdds
jwtullun::jwt - HS256 tokens and bearer-auth middleware
compressionullun::compression - gzip middleware
websocketApp::ws and ullun::websocket
fullall of the above

Always available: rate_limit, openapi, template, form parsing (Request::form) and group-level middleware.

Modules§

app
Main application orchestrator
compression
Gzip response compression middleware (feature compression)
cookies
Cookie parsing and management
error
Error types and Result alias
handler
Handler traits and types
jwt
HS256 JSON Web Tokens and a bearer-token middleware (feature jwt)
middleware
Middleware types and traits
openapi
OpenAPI 3.1 document generated from the registered routes
prelude
rate_limit
In-memory rate limiting middleware
request
Request types and extractors
response
Response types and builders
router
Router implementation using matchit
security
Small security helpers: secure random tokens and constant-time comparison
static_files
Static file serving
template
Server-side HTML templates
websocket
WebSocket endpoints (feature websocket)