static.py 379 B

12345678910
  1. from fastapi.staticfiles import StaticFiles
  2. class SPAStaticFiles(StaticFiles):
  3. async def get_response(self, path: str, scope):
  4. try:
  5. return await super().get_response(path, scope)
  6. except Exception:
  7. # FIXME: just making this HTTPException doesn't work for some reason
  8. return await super().get_response('index.html', scope)