mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-11 03:59:05 +00:00
14 lines
291 B
Rust
14 lines
291 B
Rust
|
use rocket;
|
||
|
use std::fs::File;
|
||
|
use std::io::Error as IOError;
|
||
|
|
||
|
#[route(GET, path = "/")]
|
||
|
pub fn index() -> File {
|
||
|
File::open("static/index.html").unwrap()
|
||
|
}
|
||
|
|
||
|
#[route(GET, path = "/<file>")]
|
||
|
pub fn files(file: &str) -> Result<File, IOError> {
|
||
|
File::open(format!("static/{}", file))
|
||
|
}
|