From f5fcd626e8a5c31c4ca37ab6966d4dcee955dbb9 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 25 Jan 2026 01:07:56 +0000 Subject: [PATCH] Update templates for fastapi_vue 0.5.0 catch-all toggle. --- fastapi_vue_setup.py | 5 ++--- template/backend/app.py | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fastapi_vue_setup.py b/fastapi_vue_setup.py index db9c2eb..d0bb1c8 100644 --- a/fastapi_vue_setup.py +++ b/fastapi_vue_setup.py @@ -51,9 +51,7 @@ PYPROJECT_ADDITIONS = { # Frontend instantiation block for patching existing apps FRONTEND_BLOCK = """ # Vue Frontend static files -frontend = Frontend( - Path(__file__).with_name("frontend-build"), spa=True, cached=["/assets/"] -) +frontend = Frontend(Path(__file__).with_name("frontend-build"), cached=["/assets/"]) """ # TypeScript health check script for Vue components @@ -390,6 +388,7 @@ def patch_app_file( # Append route at end lines.append("") + lines.append("# Serve the Vue frontend (needs to be last if SPA catch-all is used)") lines.append(route_line) content = "\n".join(lines) diff --git a/template/backend/app.py b/template/backend/app.py index cc695a5..9cd084a 100644 --- a/template/backend/app.py +++ b/template/backend/app.py @@ -5,9 +5,7 @@ from fastapi import FastAPI from fastapi_vue import Frontend # Vue Frontend static files -frontend = Frontend( - Path(__file__).with_name("frontend-build"), spa=True, cached=["/assets/"] -) +frontend = Frontend(Path(__file__).with_name("frontend-build"), cached=["/assets/"]) @asynccontextmanager @@ -29,5 +27,5 @@ async def health_check(): return {"status": "ok"} -# Final catch-all route for frontend files (keep at end of file) +# Serve the Vue frontend (needs to be last if SPA catch-all is used) frontend.route(app, "/")