July 2017
Beginner to intermediate
340 pages
7h 43m
English
The routing happens in app.url_map, which is an instance of Werkzeug's Map class. That class uses regular expressions to determine if a function decorated by @app.route matches the incoming request. The routing only looks at the path you provided in the route call to see if it matches the client's request.
By default, the mapper will only accept GET, OPTIONS, and HEAD calls on a declared route. Calling a valid endpoint with an unsupported method will return a 405 Method Not Allowed response together with the list of supported methods in the Allow header:
$ curl -v -XDELETE localhost:5000/api * Connected to localhost (127.0.0.1) port 5000 (#0) > DELETE /api/person/1 HTTP/1.1 > Host: localhost:5000 > User-Agent: curl/7.51.0 > Accept: ...
Read now
Unlock full access