This directory contains the in-repository examples for the rustapi-rs facade crate.
Shows cookie-backed login, session refresh, logout, and session inspection using the built-in session middleware.
Run it with:
cargo run -p rustapi-rs --example auth_api --features extras-sessionThen try:
POST http://127.0.0.1:3000/auth/loginwith{"user_id":"demo-user"}GET http://127.0.0.1:3000/auth/mePOST http://127.0.0.1:3000/auth/refreshPOST http://127.0.0.1:3000/auth/logout
Shows a compact in-memory CRUD API with list/create/read/update/delete routes.
Run it with:
cargo run -p rustapi-rs --example full_crud_apiThen try:
GET http://127.0.0.1:3000/todosPOST http://127.0.0.1:3000/todosGET http://127.0.0.1:3000/todos/1PATCH http://127.0.0.1:3000/todos/1DELETE http://127.0.0.1:3000/todos/1
Shows Server-Sent Events (SSE) with a small progress feed.
Run it with:
cargo run -p rustapi-rs --example streaming_apiThen open:
http://127.0.0.1:3000/events
Shows an in-memory job queue, enqueue endpoint, and manual worker tick endpoint.
Run it with:
cargo run -p rustapi-rs --example jobs_api --features extras-jobsThen try:
POST http://127.0.0.1:3000/jobs/emailPOST http://127.0.0.1:3000/jobs/process-nextGET http://127.0.0.1:3000/jobs/stats
Shows typed path definitions, type-safe route registration, and URI generation with TypedPath.
Run it with:
cargo run -p rustapi-rs --example typed_path_pocShows the automatic status page and a few endpoints that generate traffic, latency, and failures for demonstration purposes.
Run it with:
cargo run -p rustapi-rs --example status_demoThen open:
http://127.0.0.1:3000/statushttp://127.0.0.1:3000/fasthttp://127.0.0.1:3000/slowhttp://127.0.0.1:3000/flaky
- Keep this file aligned with the actual
.rsfiles in this directory. - User-facing examples should import from
rustapi_rs::prelude::*unless the example is explicitly about internals. - Additional example ideas tracked in
tasks.mdare roadmap items until their files exist here.