feat: serve files from export dir

This commit is contained in:
Aravinth Manivannan 2023-03-14 15:51:46 +05:30
parent 3d74a8ce89
commit 1e33e5303a
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 8 additions and 2 deletions

View file

@ -58,6 +58,8 @@ lazy_static! {
FILES.get("./static/cache/bundle/glue.js").unwrap();
}
pub const DOWNLOAD_SCOPE: &str = "/download";
pub const CACHE_AGE: u32 = 604800;
pub const COMPILED_DATE: &str = env!("COMPILED_DATE");
@ -109,7 +111,9 @@ async fn main() -> std::io::Result<()> {
.wrap(actix_middleware::NormalizePath::new(
actix_middleware::TrailingSlash::Trim,
))
.service(Files::new("/download", &settings.publish.dir).show_files_listing())
.service(
Files::new(DOWNLOAD_SCOPE, &settings.publish.dir).show_files_listing(),
)
.configure(services)
.app_data(data.clone())
})

View file

@ -126,7 +126,9 @@ macro_rules! get_app {
.wrap(actix_web::middleware::NormalizePath::new(
actix_web::middleware::TrailingSlash::Trim,
))
.service(Files::new("/download", &$settings.publish.dir).show_files_listing())
.service(
Files::new("/download", &$settings.publish.dir).show_files_listing(),
)
.configure($crate::services)
};