fix: add root redirect to /docs and show localhost in serve output
This commit is contained in:
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user