serve spa

This commit is contained in:
2021-05-02 12:32:03 +02:00
parent 7b68bd684f
commit 11d714fe94
4 changed files with 51 additions and 33 deletions

10
src/client.rs Normal file
View File

@@ -0,0 +1,10 @@
use actix_files::{Files, NamedFile};
use actix_web::{web, Responder};
pub fn init(cfg: &mut web::ServiceConfig) {
cfg.service(Files::new("/", "./client/build").index_file("index.html"));
}
pub async fn fallback_fn() -> impl Responder {
NamedFile::open("./client/build/index.html")
}