fej/src/hello/mod.rs

17 lines
330 B
Rust
Raw Normal View History

2021-03-05 23:34:38 +01:00
#[cfg(test)] mod tests;
#[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)
}