Create main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# main.py
|
| 2 |
+
# 主应用入口
|
| 3 |
+
|
| 4 |
+
from fastapi import FastAPI
|
| 5 |
+
from routes import router
|
| 6 |
+
|
| 7 |
+
# 创建FastAPI应用
|
| 8 |
+
app = FastAPI()
|
| 9 |
+
|
| 10 |
+
# 注册路由
|
| 11 |
+
app.include_router(router)
|
| 12 |
+
|
| 13 |
+
# 添加健康检查路由
|
| 14 |
+
@app.get("/health")
|
| 15 |
+
async def health_check():
|
| 16 |
+
return {"status": "ok"}
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
import uvicorn
|
| 20 |
+
uvicorn.run(app, host="0.0.0.0", port=8080)
|