Implement backend upload/download API enhancements
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user