Creating asynchronous Flask components
Flask 2.3 and up to the current version support running asynchronous API endpoint and web-based view functions over its WSGI-based platform. However, to fully use this feature, install the flask[async] module using the following pip command:
pip install flask[async]
After installing the flask[async] module, implementing synchronous views using the async/await design pattern can now be feasible.
Implementing asynchronous views and endpoints
Like Django or FastAPI, creating asynchronous views and endpoints in the Flask framework involves applying the async/await keywords. The following web view from ch05-web renders a welcome greeting message to the users with the description of our Online Voting application:
@current_app.route('/ch05/web/index')
async def welcome():
    return render_template('index.html'), 200 Another asynchronous view function from the other application, ch05-api, is showcased...