Serve static files
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
use rocket::response::NamedFile;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub mod blogs;
|
||||
pub mod comments;
|
||||
pub mod instance;
|
||||
@@ -6,3 +9,8 @@ pub mod posts;
|
||||
pub mod session;
|
||||
pub mod user;
|
||||
pub mod well_known;
|
||||
|
||||
#[get("/static/<file..>")]
|
||||
fn static_files(file: PathBuf) -> Option<NamedFile> {
|
||||
NamedFile::open(Path::new("static/").join(file)).ok()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user