Kamixitong/check_routes.py

14 lines
353 B
Python
Raw Normal View History

2025-11-11 21:39:12 +08:00
from app import create_app
2025-11-12 15:11:05 +08:00
app = create_app()
print("API routes:")
routes = []
for rule in app.url_map.iter_rules():
methods = rule.methods if rule.methods else set()
routes.append((rule.rule, ','.join(sorted(methods)), rule.endpoint))
2025-11-11 21:39:12 +08:00
2025-11-12 15:11:05 +08:00
routes.sort()
for r in routes:
if r[2].startswith('api'):
print(f'{r[0]:30} {r[1]:20} {r[2]}')