Fixed / route with better format and sorting

This commit is contained in:
Felipe Martin 2020-03-16 17:08:02 +01:00
parent 8af60cac8c
commit 97670a0b02
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
2 changed files with 2 additions and 2 deletions

2
app.py
View File

@ -12,7 +12,7 @@ app.url_map.add(Rule("/request", endpoint="request"))
def root_view():
"""List all available routes"""
routes = {}
for rule in app.url_map.iter_rules():
for rule in sorted(app.url_map.iter_rules(), key=lambda rule: rule.rule):
if rule.endpoint != "static":
# Get only the first line from the docstring as the summary
routes[rule.rule] = list(

View File

@ -4,7 +4,7 @@
<body>
<ul>
{% for path, help in routes.items() %}
<li><a href="{{ path }}"> {{ help }}</li>
<li><a href="{{ path }}">{{ path }}</a>: {{ help }}</li>
{% endfor %}
</ul>
</body>