Added arguments test
parent
57de7c66b3
commit
e498fb38c8
|
@ -2,3 +2,13 @@
|
||||||
pub fn world() -> &'static str {
|
pub fn world() -> &'static str {
|
||||||
"Hello, world!"
|
"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)
|
||||||
|
}
|
||||||
|
|
|
@ -5,5 +5,9 @@
|
||||||
mod hello;
|
mod hello;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
rocket::ignite().mount("/hello", routes![hello::routes::world]).launch();
|
rocket::ignite().mount("/hello", routes![
|
||||||
|
hello::routes::world,
|
||||||
|
hello::routes::hello,
|
||||||
|
hello::routes::name_age
|
||||||
|
]).launch();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue