Rocket Hello World


Rocket(a Rust web framework) hello world example.

#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use rocket::config;
use rocket::config::Environment;

#[get("/")]
fn hello() -> &'static str {
    "Hello world!"
}

fn main() {
    let cfg = config::Config::build(Environment::Staging)
        .port(80)
        .unwrap();
    let r = rocket::custom(cfg);
    r.mount("/", routes![hello]).launch();
}
Tags:Rust