-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

A Blueprint for Production-Ready Web Applications
By :

To manage user sessions, we need a session (authentication) API that provides routes to log in and log out (i.e., to create and delete sessions). Login should result in a cookie being set, and logout results in the cookie being deleted. As per the authentication setup, login should require an email and matching password. We’ll add this API via a sessions blueprint containing login, logout, and status functionality.
A blueprint is a collection of route handlers and is useful to associate the related session functionality. It can be created with the following code in backend/src/backend/blueprints/sessions.py:
from quart import Blueprint blueprint = Blueprint("sessions", __name__)
The blueprint then needs to be registered with the app, by adding the following to backend/src/backend/run.py:
from backend.blueprints.sessions import blueprint as sessions_blueprint app.register_blueprint(sessions_blueprint)...