Routing URLs and accepting requests (Simple)
This section will connect URLs to Python functions in our web service.
Use the project layout listed under the Project Layout section in the Running a Simple Application recipe.
How to do it...
- The Flask
appobject includes a
routedecorator to specify URL rules to use for a view function conveniently, which provides a declarative style for routing requests to Python callables. The following code routes five URL handling functions for the list, detail, creation, updating, and deletion of appointment records in our scheduling application. For now, we simply return a string describing what the handler is going to do, which we'll implement later, so that you can see the URL routing in action ...