fix: 添加根路由 + 修复 CORS 拼写
This commit is contained in:
@@ -11,6 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## [0.6.1] - 2026-03-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **根路由缺失** - 添加 `/` 路由,返回服务信息和端点列表
|
||||||
|
- **CORS 拼写错误** - 修复 `cors_allowed_origins` 拼写
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [0.6.0] - 2026-03-14
|
## [0.6.0] - 2026-03-14
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from app.extensions import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Socket.IO 实例 - 避免与 app/socketio 目录冲突
|
# Socket.IO 实例 - 避免与 app/socketio 目录冲突
|
||||||
socketio_app = SocketIO(cors_allowed_origions="*", async_mode='threading')
|
socketio_app = SocketIO(cors_allowed_origins="*", async_mode='threading')
|
||||||
|
|
||||||
|
|
||||||
def create_app(config_name='default'):
|
def create_app(config_name='default'):
|
||||||
@@ -34,6 +34,25 @@ def create_app(config_name='default'):
|
|||||||
# 注册错误处理
|
# 注册错误处理
|
||||||
_register_error_handlers(app)
|
_register_error_handlers(app)
|
||||||
|
|
||||||
|
# 根路由
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
return {
|
||||||
|
'service': 'PIT Router',
|
||||||
|
'version': '0.6.0',
|
||||||
|
'status': 'running',
|
||||||
|
'endpoints': {
|
||||||
|
'health': '/health',
|
||||||
|
'auth': '/api/auth',
|
||||||
|
'sessions': '/api/sessions',
|
||||||
|
'agents': '/api/agents',
|
||||||
|
'gateways': '/api/gateways',
|
||||||
|
'messages': '/api/messages',
|
||||||
|
'stats': '/api/stats',
|
||||||
|
'websocket': 'ws://host:9000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# 健康检查端点
|
# 健康检查端点
|
||||||
@app.route('/health')
|
@app.route('/health')
|
||||||
def health_check():
|
def health_check():
|
||||||
|
|||||||
Reference in New Issue
Block a user