Rocket/examples/extended_validation/src/files.rs

14 lines
270 B
Rust
Raw Normal View History

use rocket;
use std::fs::File;
use std::io::Error as IOError;
2016-09-04 11:06:28 +00:00
#[get(path = "/")]
pub fn index() -> File {
File::open("static/index.html").unwrap()
}
2016-09-04 11:06:28 +00:00
#[get("/<file>")]
pub fn files(file: &str) -> Result<File, IOError> {
File::open(format!("static/{}", file))
}