refactor(router): 重构项目结构,将主入口移至router/main.py

删除旧的main.py文件,将FastAPI应用创建逻辑集中在router/main.py中
添加直接运行router/main.py的支持
更新README.md以反映新的项目结构和使用方式
添加websocket连接测试脚本test_websocket.py
This commit is contained in:
Yuyao Huang (Sam)
2026-03-29 16:46:23 +08:00
parent 71e3f14788
commit 9173aa6094
4 changed files with 61 additions and 127 deletions
+15
View File
@@ -74,3 +74,18 @@ def create_app(router_secret: Optional[str] = None) -> FastAPI:
logger.info("Router shut down")
return app
if __name__ == "__main__":
from config import PORT, ROUTER_SECRET
import uvicorn
app = create_app(router_secret=ROUTER_SECRET)
uvicorn.run(
"router.main:app",
host="0.0.0.0",
port=PORT,
reload=False,
log_level="info",
ws_ping_interval=20,
ws_ping_timeout=60,
)