Rocket/examples/todo/src/static_files.rs

9 lines
213 B
Rust
Raw Normal View History

2016-09-12 08:51:02 +00:00
use rocket::response::NamedFile;
use std::io;
use std::path::{Path, PathBuf};
#[get("/<path..>", rank = 5)]
2016-09-12 08:51:02 +00:00
fn all(path: PathBuf) -> io::Result<NamedFile> {
NamedFile::open(Path::new("static/").join(path))
}