A RegexSet
based router for use with Rust web servers
(currently only supports Hyper 0.11.6).
Use like:
rust,ignore
let router = Router::build()
.add_get(r"\A/\z", |_| Ok::<_, Response>(Response::new().with_body("ROOT path")))
.add_not_found(|_| Ok::<_, Response>(Response::new().with_body("Route not found")))
.finish()
.unwrap();
router.quick_serve(8, "0.0.0.0:3000".parse().unwrap(), || Core::new().unwrap() );
See simple.rs for how to use the router with Hyper.
Works well with futures-await
for a nicer async experience.
License: MIT
reset_router::hyper::{Context, Router}
and bring
your own hyper
.Context
(rename to Request
on use
if desired)into_inner
(use into_request
)