Update download_api.py
Browse files- download_api.py +9 -5
download_api.py
CHANGED
|
@@ -61,15 +61,19 @@ async def startup_event():
|
|
| 61 |
|
| 62 |
from fastapi.staticfiles import StaticFiles
|
| 63 |
|
| 64 |
-
|
| 65 |
|
|
|
|
| 66 |
@app.get("/")
|
| 67 |
async def root():
|
| 68 |
-
|
| 69 |
-
return FileResponse(os.path.join(BASE_DIR, 'index.html'))
|
| 70 |
|
| 71 |
-
#
|
| 72 |
-
app.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
|
| 75 |
@app.route('/status')
|
|
|
|
| 61 |
|
| 62 |
from fastapi.staticfiles import StaticFiles
|
| 63 |
|
| 64 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 65 |
|
| 66 |
+
# Serve your main HTML file
|
| 67 |
@app.get("/")
|
| 68 |
async def root():
|
| 69 |
+
return FileResponse("index.html")
|
|
|
|
| 70 |
|
| 71 |
+
# Optional: If you need to serve other static files individually
|
| 72 |
+
@app.get("/{filename}")
|
| 73 |
+
async def serve_file(filename: str):
|
| 74 |
+
if filename in ['style.css', 'script.js']:
|
| 75 |
+
return FileResponse(f"static/{filename}")
|
| 76 |
+
return FileResponse(f"static/{filename}")
|
| 77 |
|
| 78 |
|
| 79 |
@app.route('/status')
|