Building the To-Do API
To manage to-dos, we need an API that provides functionality to create a new to-do, retrieve a to-do or to-dos, update a to-do, and delete a to-do (i.e., an API that has CRUD functionality). We’ll do this by creating a to-do blueprint with a route per CRUD function.
CRUD functionality
CRUD stands for Create
, Read
, Update
, and Delete
, and is used to describe a set of functionalities. It is often used to describe the functionality of RESTful APIs. Typically, for a RESTFul API, the Create route uses the POST
HTTP method, Read uses GET,
Update uses PUT
, and Delete uses DELETE
.
Creating the blueprint
The blueprint itself can be created with the following code in backend/src/backend/blueprints/todos.py:
from quart import Blueprint blueprint = Blueprint("todos", __name__)
The blueprint then needs to be registered with the app, by adding the following to backend/src/backend/run.py:
from backend.blueprints.todos import blueprint as...