Show 404 when specific route matches
I have the following routes setup, matching a rest api on /rest.
routes = [
PathPrefixRoute('/rest', [
Route('/customers', handler='app.handlers.CustomerHandler:list',
methods=['GET']),
# some other /rest routers
Route('/<:.*>', ?) # this route should execute abort(404)
]),
Route('/<page:.*>', handler='app.handlers.PageHandler', methods=['GET'])
]
If somebody accesses a /rest/does_not_exists url I want to show 404.
Is there a way to invoke abort(404) from a route or should I create a
handler for that?
No comments:
Post a Comment