server: Make sure to fallback to the app when an unknown file is encountered
This commit is contained in:
parent
2ac56e2e7f
commit
47e4eed1a9
1 changed files with 4 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ use jwt_simple::prelude::HS256Key;
|
|||
use migration::{Migrator, MigratorTrait};
|
||||
use sea_orm::{ConnectOptions, Database, DatabaseConnection};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use tower_http::services::ServeDir;
|
||||
use tower_http::services::{ServeDir, ServeFile};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
pub(crate) mod entity;
|
||||
|
|
@ -130,7 +130,9 @@ async fn main() -> anyhow::Result<()> {
|
|||
|
||||
let router = match config.serve_app {
|
||||
None => router,
|
||||
Some(path) => router.fallback_service(ServeDir::new(path)),
|
||||
Some(path) => router.fallback_service(
|
||||
ServeDir::new(&path).fallback(ServeFile::new(path.join("index.html"))),
|
||||
),
|
||||
};
|
||||
|
||||
tracing::info!("Listening on {addr}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue