fej/src/hello/routes.rs

15 lines
305 B
Rust

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