[][src]Function gotham::router::builder::build_simple_router

pub fn build_simple_router<F>(f: F) -> Router where
    F: FnOnce(&mut RouterBuilder<(), ()>), 

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);
    })
}