Rocket/examples/hello_ranks/src/main.rs

20 lines
460 B
Rust
Raw Normal View History

#![feature(plugin)]
2016-09-09 03:38:58 +00:00
#![plugin(rocket_codegen)]
extern crate rocket;
use rocket::Rocket;
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 {
format!("Hi {}! You age ({}) is kind of funky.", name, age)
}
fn main() {
Rocket::new("localhost", 8000).mount_and_launch("/", routes![hi, hello]);
}