mirror of https://github.com/rwf2/Rocket.git
19 lines
352 B
Rust
19 lines
352 B
Rust
|
#![feature(plugin)]
|
||
|
#![plugin(rocket_macros)]
|
||
|
|
||
|
extern crate rocket;
|
||
|
use rocket::Rocket;
|
||
|
|
||
|
#[route(GET, path = "/users/<name>")]
|
||
|
fn user(name: &str) -> Option<&'static str> {
|
||
|
if name == "Sergio" {
|
||
|
Some("Hello, Sergio!")
|
||
|
} else {
|
||
|
None
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
Rocket::new("localhost", 8000).mount_and_launch("/", routes![user]);
|
||
|
}
|