cryptgeon/backend/src/client.rs

18 lines
446 B
Rust
Raw Normal View History

2022-03-05 12:47:11 +01:00
use actix_files::{Files, NamedFile};
use actix_web::{web, Result};
2021-05-02 12:32:03 +02:00
use crate::config;
2021-05-02 12:32:03 +02:00
pub fn init(cfg: &mut web::ServiceConfig) {
2022-03-12 14:07:33 +01:00
cfg.service(
Files::new("/", config::FRONTEND_PATH.to_string())
2022-03-12 14:07:33 +01:00
.index_file("index.html")
.use_etag(true),
);
2021-05-02 12:32:03 +02:00
}
2022-03-05 12:47:11 +01:00
pub async fn index() -> Result<NamedFile> {
let index = format!("{}{}", config::FRONTEND_PATH.to_string(), "/index.html");
Ok(NamedFile::open(index)?)
2022-03-05 12:47:11 +01:00
}