fix: add root redirect to /docs and show localhost in serve output

This commit is contained in:
2026-07-05 01:19:48 +08:00
parent 30a1c1af57
commit 2f0aa38fbf
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -84,6 +84,13 @@ app = FastAPI(
)
@app.get("/")
def root():
"""根路径重定向到 API 文档."""
from fastapi.responses import RedirectResponse
return RedirectResponse(url="/docs")
@app.get("/api/v1/health")
def health():
return {"status": "ok"}