feat: 添加官网主页路由及静态文件支持
- 在 api/routers 中新增 home.py 路由,提供应用官网主页的 HTML 响应。 - 更新 main.py,包含 home 路由并挂载静态文件目录。 - 新增静态文件 home.html 和 avatar_assistant.png,丰富官网内容。 - 更新 .gitignore,确保 certs/ 目录被忽略。
This commit is contained in:
22
api/routers/home.py
Normal file
22
api/routers/home.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
应用官网主页路由
|
||||
"""
|
||||
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("/home", response_class=HTMLResponse)
|
||||
async def get_home():
|
||||
"""
|
||||
应用官网主页
|
||||
|
||||
包含应用介绍、功能展示、下载链接、定价方案等
|
||||
"""
|
||||
html_path = _STATIC_DIR / "home.html"
|
||||
return HTMLResponse(content=html_path.read_text(encoding="utf-8"))
|
||||
Reference in New Issue
Block a user