#![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 result = rocket::ignite() // .mount("/", routes![hello, hello]) // uncoment this to get an error .mount("/", routes![hello]) .register(catchers![not_found]) .launch(); if let Err(e) = result { println!("Whoops! Rocket didn't launch!"); println!("This went wrong: {:?}", e); }; }