Rocket/examples/hello_ranks/src/main.rs

21 lines
450 B
Rust
Raw Normal View History

#![feature(plugin)]
2016-09-09 03:38:58 +00:00
#![plugin(rocket_codegen)]
extern crate rocket;
#[cfg(test)] mod tests;
2016-09-04 11:06:28 +00:00
#[get("/hello/<name>/<age>")]
fn hello(name: &str, age: i8) -> String {
format!("Hello, {} year old named {}!", age, name)
}
2016-09-04 11:06:28 +00:00
#[get("/hello/<name>/<age>", rank = 2)]
fn hi(name: &str, age: &str) -> String {
2016-09-23 04:10:36 +00:00
format!("Hi {}! Your age ({}) is kind of funky.", name, age)
}
fn main() {
rocket::ignite().mount("/", routes![hi, hello]).launch();
}