We'll write a very simple REST server that provides a series of hands of dominoes. This will work by routing a URI to a function that will provide the hands. The function must create a response object that includes one or more of the following items:
- A status code: The default is 200, which indicates success.
- Headers: The default is a minimal set of response headers with the content size.
- Content: This can be a stream of bytes. In many cases, RESTful web services will return a document using JSON notation. The Flask framework provides us with a handy function for converting objects to JSON Notation, jsonify().
A Flask application that deals a simple hand of dominoes can be defined as follows:
from ...