Rocket/examples/hello_person/src/main.rs

20 lines
381 B
Rust

#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
#[cfg(test)] mod tests;
#[get("/hello/<name>/<age>")]
fn hello(name: String, age: u8) -> String {
format!("Hello, {} year old named {}!", age, name)
}
#[get("/hello/<name>")]
fn hi(name: String) -> String {
name
}
fn main() {
rocket::ignite().mount("/", routes![hello, hi]).launch();
}