| 123456789101112131415161718192021222324252627 |
- import os
- from fastapi import HTTPException
- from fastapi.responses import HTMLResponse, FileResponse
- from fastapi.staticfiles import StaticFiles
- async def serve_app_html():
- """Serve the main HTML file"""
- index_path = os.path.join("public","main", "index.html")
- if not os.path.exists(index_path):
- raise HTTPException(status_code=404, detail="public/index.html not found.")
- return FileResponse(index_path)
- async def serve_register_html():
- """Serve the register HTML file"""
- register_path = os.path.join("public", "register", "index.html")
- if not os.path.exists(register_path):
- raise HTTPException(status_code=404, detail="public/register/index.html not found.")
- return FileResponse(register_path)
- def mount_register_static_files(app):
- """Mount static files for the register page"""
- app.mount("/register/", StaticFiles(directory="public/register", html=False), name="register_static")
- def mount_main_static_files(app):
- """Mount static files"""
- app.mount("/express/", StaticFiles(directory="public/main", html=False), name="public_root_assets")
|