Backup-bdg's picture
Upload 964 files
51ff9e5 verified
raw
history blame contribute delete
473 Bytes
from fastapi.staticfiles import StaticFiles
from starlette.responses import Response
from starlette.types import Scope
class SPAStaticFiles(StaticFiles):
async def get_response(self, path: str, scope: Scope) -> Response:
try:
return await super().get_response(path, scope)
except Exception:
# FIXME: just making this HTTPException doesn't work for some reason
return await super().get_response('index.html', scope)