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)
|
|
|
|
}
|