Skip to content

Routing

All routes in Pavex must be registered with the application Blueprint via its route method:

use pavex::blueprint::{router::GET, Blueprint};
use pavex::f;

pub fn blueprint() -> Blueprint {
    let mut bp = Blueprint::new();
    bp.route(GET, "/greet", f!(crate::routes::greet));
    bp
}

Blueprint::route expects three arguments: a method guard, a path pattern and a request handler.