usher 0.1.1

Parameterized routing for generic resources in Rust
Documentation
// use hyper::rt::{self, Future};
// use hyper::service::service_fn_ok;
// use hyper::{Body, Request, Response, Server, StatusCode};

fn main() {
    //     // Create our address to bind to, localhost:3000
    //     let addr = ([127, 0, 0, 1], 3000).into();

    //     // Construct our Hyper server.
    //     let server = Server::bind(&addr)
    //         .serve(|| {
    //             use usher::http::HttpRouter;
    //             use usher::prelude::*;

    //             // Defines our handler type (just a boxed function).
    //             type Handler = Box<Fn(Request<Body>) -> Response<Body> + Send + Sync>;

    //             // Construct our HTTP router using only a static parser.
    //             let mut router: HttpRouter<Handler> = HttpRouter::new(vec![Box::new(StaticParser)]);

    //             // Register a handler on the "/" path, for GET requests.
    //             router.get(
    //                 "/",
    //                 Box::new(|req| {
    //                     let message = format!(
    //                         "Received {} request on path {}",
    //                         req.method(),
    //                         req.uri().path()
    //                     );

    //                     Response::new(message.into())
    //                 }),
    //             );

    //             // Create our service function to return a 404.
    //             service_fn_ok(move |req: Request<Body>| {
    //                 // First we have to extract the method and path combination.
    //                 let method = req.method();
    //                 let path = req.uri().path();

    //                 // Then we look for our handler in the router.
    //                 match router.handler(method, path) {
    //                     // If a handler is found, we just have to call it!
    //                     //
    //                     // In our example we don't care about any captures,
    //                     // but this is where handling for those would also occur.
    //                     Some((handler, _captures)) => handler(req),

    //                     // If no handler matches, keep the 404 response!
    //                     //
    //                     // This acts as a default response to pass back when we
    //                     // can't find a handler to deal with a request.
    //                     None => {
    //                         let mut response = Response::new(Body::empty());
    //                         *response.status_mut() = StatusCode::NOT_FOUND;
    //                         response
    //                     }
    //                 }
    //             })
    //         })
    //         .map_err(|e| eprintln!("server error: {}", e));

    //     // Log the port we're listening on so we don't forget!
    //     println!("Listening on http://{}", addr);

    //     // Initialze the actual service.
    //     rt::run(server);
}