Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Testing

How a test drives a contributed route without a running server.

Test a route

let ctx = RouteCtx::builder(db)
    .admin_path("/backoffice")
    .base_url("https://acme.example")
    .build();

let response = Robots.mount(&ctx)
    .oneshot(Request::get("/").body(Body::empty())?)
    .await?;
BuilderDefault
base_path(..)/, where the screen mounted.
admin_path(..)/admin, where the panel mounted.
base_url(..)http://localhost, the site’s origin.
contributions(registry)Empty: what ctx.contributions reads.
events(events)A bus nothing listens on.
auth(service)A default service over the same database.

Every builder field has a default; name only what you assert on.