8e61dc4df4
The frontend blueprint is registered after the api blueprint so /api/* routes are matched first; everything else falls through to the SPA. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
18 lines
578 B
Python
18 lines
578 B
Python
"""Serves the built Vue SPA from frontend/dist/ with history-mode fallback."""
|
|
|
|
from pathlib import Path
|
|
|
|
from quart import Blueprint, send_from_directory
|
|
|
|
FRONTEND_DIST = Path(__file__).resolve().parent.parent.parent / "frontend" / "dist"
|
|
|
|
frontend_bp = Blueprint("frontend", __name__)
|
|
|
|
|
|
@frontend_bp.route("/")
|
|
@frontend_bp.route("/<path:subpath>")
|
|
async def serve_spa(subpath: str = ""):
|
|
if subpath and (FRONTEND_DIST / subpath).is_file():
|
|
return await send_from_directory(FRONTEND_DIST, subpath)
|
|
return await send_from_directory(FRONTEND_DIST, "index.html")
|