Function gotham::router::builder::build_simple_router
source · pub fn build_simple_router<F>(f: F) -> Routerwhere
F: FnOnce(&mut RouterBuilder<'_, (), ()>),
Expand description
Builds a Router
with no middleware using the provided closure. Routes are defined using
the RouterBuilder
value passed to the closure, and the Router
is constructed before
returning.
fn router() -> Router {
build_simple_router(|route| {
route.get("/request/path").to(my_handler);
})
}