pub fn build_router<C, P, F>(
pipeline_chain: C,
pipelines: PipelineSet<P>,
f: F
) -> Router where
C: PipelineHandleChain<P> + Copy + Send + Sync + 'static,
P: Send + Sync + 'static,
F: FnOnce(&mut RouterBuilder<'_, C, P>),
Expand description
Builds a Router
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 {
let (chain, pipelines) = single_pipeline(
new_pipeline()
.add(NewSessionMiddleware::default().with_session_type::<Session>())
.build()
);
build_router(chain, pipelines, |route| {
route.get("/request/path").to(my_handler);
})
}