2016-03-22 23:27:12 +00:00
|
|
|
#![feature(plugin)]
|
2016-09-09 03:38:58 +00:00
|
|
|
#![plugin(rocket_codegen)]
|
2016-03-22 23:27:12 +00:00
|
|
|
|
|
|
|
extern crate rocket;
|
2016-09-08 07:02:17 +00:00
|
|
|
|
2016-09-12 08:51:02 +00:00
|
|
|
use std::io;
|
2016-09-08 07:02:17 +00:00
|
|
|
use std::path::{Path, PathBuf};
|
2016-03-22 23:27:12 +00:00
|
|
|
|
2016-12-15 08:47:31 +00:00
|
|
|
use rocket::response::NamedFile;
|
2016-11-02 15:55:56 +00:00
|
|
|
|
2016-09-04 11:06:28 +00:00
|
|
|
#[get("/")]
|
2016-09-12 08:51:02 +00:00
|
|
|
fn index() -> io::Result<NamedFile> {
|
|
|
|
NamedFile::open("static/index.html")
|
2016-03-22 23:27:12 +00:00
|
|
|
}
|
|
|
|
|
2016-09-08 07:02:17 +00:00
|
|
|
#[get("/<file..>")]
|
2016-12-15 08:47:31 +00:00
|
|
|
fn files(file: PathBuf) -> Option<NamedFile> {
|
|
|
|
NamedFile::open(Path::new("static/").join(file)).ok()
|
2016-03-22 23:27:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2016-10-04 02:48:33 +00:00
|
|
|
rocket::ignite().mount("/", routes![index, files]).launch();
|
2016-03-22 23:27:12 +00:00
|
|
|
}
|