Rocket/examples/hello_person/src/main.rs

15 lines
321 B
Rust
Raw Normal View History

#![feature(plugin)]
#![plugin(rocket_macros)]
extern crate rocket;
use rocket::Rocket;
#[route(GET, path = "/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)
}
fn main() {
Rocket::new("localhost", 8000).mount_and_launch("/", routes![hello]);
}