from fastapi import APIRouter from fastapi.responses import HTMLResponse import os from app.core.config import settings router = APIRouter() @router.get("/", response_class=HTMLResponse) async def read_root(): # 读取 static/index.html 内容返回 index_path = os.path.join(settings.STATIC_DIR, "index.html") if os.path.exists(index_path): with open(index_path, 'r', encoding='utf-8') as f: return f.read() return "

Index.html not found

"