#![feature(proc_macro_hygiene)] #[macro_use] extern crate rocket; #[cfg(test)] mod tests; use rocket::response::content; #[get("/hello//")] fn hello(name: String, age: i8) -> String { format!("Hello, {} year old named {}!", age, name) } #[catch(404)] fn not_found(req: &rocket::Request<'_>) -> content::Html { content::Html(format!("

Sorry, but '{}' is not a valid path!

Try visiting /hello/<name>/<age> instead.

", req.uri())) } fn main() { let e = rocket::ignite() // .mount("/", routes![hello, hello]) // uncoment this to get an error .mount("/", routes![hello]) .register(catchers![not_found]) .launch(); println!("Whoops! Rocket didn't launch!"); // TODO.async Uncomment the following line once `.launch()`'s error type is determined. // println!("This went wrong: {}", e); }