Rocket/examples/hello_person/src/main.rs

20 lines
381 B
Rust
Raw Normal View History

2018-10-06 04:56:46 +00:00
#![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 {
2016-03-18 03:37:34 +00:00
format!("Hello, {} year old named {}!", age, name)
}
#[get("/hello/<name>")]
fn hi(name: String) -> String {
name
}
fn main() {
2016-12-19 09:57:13 +00:00
rocket::ignite().mount("/", routes![hello, hi]).launch();
}