mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2026-09-26 20:41:45 +00:00
fix: keep SPA fallback for non-api paths but 404 unmatched /api routes
This commit is contained in:
@@ -20,6 +20,10 @@ mod note;
|
|||||||
mod status;
|
mod status;
|
||||||
mod store;
|
mod store;
|
||||||
|
|
||||||
|
async fn api_not_found() -> axum::http::StatusCode {
|
||||||
|
axum::http::StatusCode::NOT_FOUND
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
@@ -39,7 +43,9 @@ async fn main() {
|
|||||||
.nest("/notes", notes_routes)
|
.nest("/notes", notes_routes)
|
||||||
.merge(status_routes);
|
.merge(status_routes);
|
||||||
|
|
||||||
let api_routes = Router::new().nest("/v3", v3_routes);
|
let api_routes = Router::new()
|
||||||
|
.nest("/v3", v3_routes)
|
||||||
|
.fallback(api_not_found);
|
||||||
|
|
||||||
let index = format!("{}{}", config::FRONTEND_PATH.to_string(), "/index.html");
|
let index = format!("{}{}", config::FRONTEND_PATH.to_string(), "/index.html");
|
||||||
let serve_dir =
|
let serve_dir =
|
||||||
|
|||||||
Reference in New Issue
Block a user