refactor: 将根路径和健康检查端点添加API前缀

统一API端点路径格式,确保所有路由都使用API_PREFIX作为前缀,保持一致性
This commit is contained in:
2025-12-16 11:27:14 +08:00
parent 58b1a5433f
commit 94b6cc8f8d

View File

@@ -32,12 +32,12 @@ from src.routers import wechat_router
app.include_router(wechat_router, prefix=API_PREFIX+"/wechat", tags=["企业微信"]) app.include_router(wechat_router, prefix=API_PREFIX+"/wechat", tags=["企业微信"])
# 根路径端点,返回欢迎信息 # 根路径端点,返回欢迎信息
@app.get("/") @app.get(API_PREFIX+"/")
async def root(): async def root():
return {"message": "Welcome to 规范FastApi 开发基础框架"} return {"message": "Welcome to 规范FastApi 开发基础框架"}
# 健康检查端点,用于检查应用是否正常运行 # 健康检查端点,用于检查应用是否正常运行
@app.get("/health") @app.get(API_PREFIX+"/health")
async def health_check(): async def health_check():
return {"status": "healthy"} return {"status": "healthy"}