Spaces:
Sleeping
Sleeping
fix path to frontend
Browse files- app/main.py +3 -9
app/main.py
CHANGED
|
@@ -15,11 +15,6 @@ app = FastAPI(
|
|
| 15 |
version="1.0.0",
|
| 16 |
)
|
| 17 |
|
| 18 |
-
# Mount the frontend directory as static files under /static
|
| 19 |
-
FRONTEND_DIR = Path(__file__).resolve().parents[1] / "frontend"
|
| 20 |
-
if FRONTEND_DIR.exists():
|
| 21 |
-
app.mount("/static", StaticFiles(directory=str(FRONTEND_DIR)), name="static")
|
| 22 |
-
|
| 23 |
# Allow simple cross-origin requests from local development (adjust in production)
|
| 24 |
app.add_middleware(
|
| 25 |
CORSMiddleware,
|
|
@@ -50,7 +45,6 @@ async def health_check() -> dict[str, str]:
|
|
| 50 |
@app.get("/", response_model=None)
|
| 51 |
async def root() -> FileResponse | dict[str, str]:
|
| 52 |
"""Serve the frontend `index.html` if present, otherwise return small JSON status."""
|
| 53 |
-
index_file =
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
return {"status": "ok", "message": "Frontend not found"}
|
|
|
|
| 15 |
version="1.0.0",
|
| 16 |
)
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Allow simple cross-origin requests from local development (adjust in production)
|
| 19 |
app.add_middleware(
|
| 20 |
CORSMiddleware,
|
|
|
|
| 45 |
@app.get("/", response_model=None)
|
| 46 |
async def root() -> FileResponse | dict[str, str]:
|
| 47 |
"""Serve the frontend `index.html` if present, otherwise return small JSON status."""
|
| 48 |
+
index_file = "frontend/index.html"
|
| 49 |
+
return FileResponse(index_file)
|
| 50 |
+
|
|
|