mirror of https://github.com/rwf2/Rocket.git
21 lines
381 B
Rust
21 lines
381 B
Rust
#![feature(plugin)]
|
|
#![plugin(rocket_codegen)]
|
|
|
|
extern crate rocket;
|
|
|
|
#[cfg(test)] mod tests;
|
|
|
|
#[get("/hello/<name>/<age>")]
|
|
fn hello(name: &str, age: i8) -> String {
|
|
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();
|
|
}
|