Files
life-echo/api/routers/home.py
penghanyuan d9e010ef70 feat: 更新 API 主页路由及 FastAPI 配置
- 将主页路由从 "/home" 更新为根路径 "/",以简化访问。
- 在 FastAPI 实例中禁用文档和 OpenAPI 相关的 URL,提升 API 安全性。
2026-02-14 21:25:37 +01:00

23 lines
526 B
Python

"""
应用官网主页路由
"""
from pathlib import Path
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
router = APIRouter(tags=["home"])
_STATIC_DIR = Path(__file__).resolve().parent.parent / "static"
@router.get("/", response_class=HTMLResponse)
async def get_home():
"""
应用官网主页
包含应用介绍、功能展示、下载链接、定价方案等
"""
html_path = _STATIC_DIR / "home.html"
return HTMLResponse(content=html_path.read_text(encoding="utf-8"))