Fixed / route with better format and sorting
This commit is contained in:
parent
8af60cac8c
commit
97670a0b02
2
app.py
2
app.py
|
@ -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(
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue