This parallels the server shown in the Parsing a JSON request recipe. There are some important modifications:
- Create the local self-signed certificate or purchase a certificate from a certificate authority. For this recipe, we'll assume the two filenames are ssl.cert and ssl.key.
- Import the modules required to build a server. Also import the User class definition:
from flask import Flask, jsonify, request, abort, url_for from ch12_r07_user import User from http import HTTPStatus
- Include the @authorization_required decorator definition.
- Define a route with no authentication. This will be used to create new users. A similar view function was defined in the Parsing a JSON request recipe. This version requires a password ...