fej/src/hello/mod.rs

25 lines
427 B
Rust

#[cfg(test)] mod tests;
pub fn routes() -> Vec<rocket::Route> {
routes![
world,
hello,
name_age
]
}
#[get("/world")]
fn world() -> &'static str {
"Hello, world!"
}
#[get("/<name>")]
fn hello(name: String) -> String {
format!("Hello, {}", name)
}
#[get("/world?<name>&<age>")]
fn name_age(name: String, age: u16) -> String {
format!("Hello, {} who is {} years old!", name, age)
}