In this chapter, we will expand the capabilities of the RESTful API that we started in the previous chapter. We will use SQLAlchemy as our ORM to work with a PostgreSQL database and we will take advantage of advanced features included in Flask and Flask-RESTful that will allow us to easily organize code for complex APIs, such as models and blueprints. In this chapter, we will:
Design a RESTful API to interact with a PostgreSQL database
Understand the tasks performed by each HTTP method
Install packages to simplify our common tasks
Create and configure the database
Write code for the models with their relationships
Use schemas to validate, serialize, and deserialize models
Combine blueprints with resourceful routing
Register the blueprint and run migrations
Create and retrieve related resources