| 1234567891011121314151617 |
- import os
- from fastapi import HTTPException
- from fastapi.responses import HTMLResponse, FileResponse
- from fastapi.staticfiles import StaticFiles
- async def serve_index_html():
- """Serve the main HTML file"""
- index_path = os.path.join("public", "index.html")
- if not os.path.exists(index_path):
- raise HTTPException(status_code=404, detail="public/index.html not found.")
- return FileResponse(index_path)
- def mount_static_files(app):
- """Mount static files"""
- app.mount("/", StaticFiles(directory="public", html=False), name="public_root_assets")
|