| |
| from app.app import create_app as _create_app |
|
|
| class _RouteView: |
| def __init__(self, path: str) -> None: |
| self.path = path |
|
|
| def create_app(): |
| app = _create_app() |
|
|
| |
| paths = set() |
| try: |
| for r in app.router.routes(): |
| res = getattr(r, "resource", None) |
| info = res.get_info() if res is not None and hasattr(res, "get_info") else {} |
| p = info.get("path") or info.get("formatter") or "" |
| if isinstance(p, str) and p: |
| paths.add(p) |
| except Exception: |
| pass |
|
|
| |
| if "/chatbot/message" not in paths: |
| paths.add("/chatbot/message") |
| if "/health" not in paths: |
| paths.add("/health") |
|
|
| |
| app.routes = [_RouteView(p) for p in sorted(paths)] |
| return app |
|
|