Blueprint
The core of a Pavex project is its Blueprint
.
It's the type you'll use to define your API: routes, middlewares, error handlers, etc.
You can find the Blueprint
for the demo
project in the app/src/blueprint.rs
file:
app/src/blueprint.rs
// [...]
pub fn blueprint() -> Blueprint {
let mut bp = Blueprint::new();
// Bring into scope all macro-annotated components
// defined in the crates listed via `from!`.
bp.import(from![
// Local components, defined in this crate
crate,
// Components defined in the `pavex` crate,
// by the framework itself.
pavex,
]);
telemetry::register(&mut bp);
routes::register(&mut bp);
bp
}