Rocket/examples/hello_person/src/main.rs

21 lines
381 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;
#[get("/hello/<name>/<age>")]
fn hello(name: &str, age: i8) -> String {
2016-03-18 03:37:34 +00:00
format!("Hello, {} year old named {}!", age, name)
}
#[get("/hello/<name>")]
fn hi<'r>(name: &'r str) -> &'r str {
name
}
fn main() {
rocket::ignite().mount("/<test>", routes![hello, hi]).launch();
}