Implement backend upload/download API enhancements

This commit is contained in:
Mondo Diaz
2025-12-11 18:05:08 -06:00
parent e9404a4425
commit c119ab4a04
10 changed files with 1214 additions and 41 deletions

View File

@@ -57,11 +57,12 @@ if os.path.exists(static_dir):
# Catch-all for SPA routing (must be last)
@app.get("/{full_path:path}")
async def serve_spa_routes(full_path: str):
# Don't catch API routes
if full_path.startswith("api/") or full_path.startswith("health") or full_path.startswith("project/"):
# Don't catch API routes or health endpoint
if full_path.startswith("api/") or full_path.startswith("health"):
from fastapi import HTTPException
raise HTTPException(status_code=404, detail="Not found")
# Serve SPA for all other routes (including /project/*)
index_path = os.path.join(static_dir, "index.html")
if os.path.exists(index_path):
return FileResponse(index_path)