Consuming API endpoints
Our ch03-client project is a web-based Flask application that utilizes the API endpoints created in the ch03 application. So far, the easiest way to consume a Flask API endpoint is to use the requests extension module. To install the requests library, run the following command:
pip install requests
This requests module has a get() helper method to send an HTTP GET request to a URL to retrieve some server resources. The following view function from the ch03-client project retrieves a list of customers and employees from the ch03 application and passes them as context data to the add_order.html template:
@current_app.route('/client/order/add', methods = ['GET', 'POST'])
def add_order():
    if request.method == 'POST':
        order_dict = request.form.to_dict(flat=True)
        order_add_api = "http://localhost...