Hi, Trying your example, I had CORS problem using the rest api. Found on flask-cors.readthedocs.io/en/latest : In the simplest case, initialize the Flask-Cors extension with default arguments in order to allow CORS for all domains on all routes.
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
If it can help someone :)