Struct hyper_router::Route
[−]
[src]
pub struct Route { pub method: Method, pub path: Path, pub handler: Handler, }
Holds route information
Fields
method: Method
HTTP method to match
path: Path
Path to match
handler: Handler
Request handler
This should be method that accepts Hyper's Request and Response:
ⓘThis example is not tested
use hyper::server::{Request, Response}; use hyper::header::{ContentLength, ContentType}; fn hello_handler(_: Request) -> Response { let body = "Hello World"; Response::new() .with_header(ContentLength(body.len() as u64)) .with_header(ContentType::plaintext()) .with_body(body) }