#![feature(plugin)] #![plugin(rocket_codegen)] extern crate rocket; use std::io; use std::path::{Path, PathBuf}; use rocket::response::NamedFile; #[get("/")] fn index() -> io::Result { NamedFile::open("static/index.html") } #[get("/")] fn files(file: PathBuf) -> Option { NamedFile::open(Path::new("static/").join(file)).ok() } fn main() { rocket::ignite().mount("/", routes![index, files]).launch(); }