2016-03-28 09:34:09 +00:00
|
|
|
#![feature(plugin)]
|
2016-09-09 03:38:58 +00:00
|
|
|
#![plugin(rocket_codegen)]
|
2016-03-28 09:34:09 +00:00
|
|
|
|
|
|
|
extern crate rocket;
|
|
|
|
use rocket::Rocket;
|
|
|
|
|
2016-09-04 11:06:28 +00:00
|
|
|
#[get("/users/<name>")]
|
2016-03-30 21:04:00 +00:00
|
|
|
fn user(name: &str) -> Option<&'static str> {
|
2016-03-28 09:34:09 +00:00
|
|
|
if name == "Sergio" {
|
|
|
|
Some("Hello, Sergio!")
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
Rocket::new("localhost", 8000).mount_and_launch("/", routes![user]);
|
|
|
|
}
|