2016-09-12 08:51:02 +00:00
|
|
|
use rocket::response::NamedFile;
|
2016-07-16 04:09:08 +00:00
|
|
|
|
2016-09-12 08:51:02 +00:00
|
|
|
use std::io;
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
|
|
|
|
#[get("/")]
|
2018-09-20 04:14:30 +00:00
|
|
|
pub fn index() -> io::Result<NamedFile> {
|
2016-09-12 08:51:02 +00:00
|
|
|
NamedFile::open("static/index.html")
|
2016-07-16 04:09:08 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 07:14:42 +00:00
|
|
|
#[get("/<file..>", rank = 2)]
|
2018-09-20 04:14:30 +00:00
|
|
|
pub fn files(file: PathBuf) -> io::Result<NamedFile> {
|
2016-09-12 08:51:02 +00:00
|
|
|
NamedFile::open(Path::new("static/").join(file))
|
2016-07-16 04:09:08 +00:00
|
|
|
}
|