#![allow(unreachable_code)]
#[macro_use]
extern crate rouille;
fn main() {
println!("Now listening on localhost:8000");
rouille::start_server("localhost:8000", move |request| {
router!(request,
(GET) (/) => {
rouille::Response::redirect_302("/hello/world")
},
(GET) (/hello/world) => {
println!("hello world");
rouille::Response::text("hello world")
},
(GET) (/panic) => {
panic!("Oops!")
},
(GET) (/{id: u32}) => {
println!("u32 {:?}", id);
rouille::Response::empty_400()
},
(GET) (/{id: String}) => {
println!("String {:?}", id);
rouille::Response::text(format!("hello, {}", id))
},
_ => rouille::Response::empty_404()
)
});
}