flask cors policy no 27access control allow origin 27

Solutions on MaxInterview for flask cors policy no 27access control allow origin 27 by the best coders in the world

showing results for - "flask cors policy no 27access control allow origin 27"
Yannic
18 Jan 2020
1# initialization
2app = Flask(__name__)
3app.config['SECRET_KEY'] = 'the quick brown fox jumps over the lazy   dog'
4app.config['CORS_HEADERS'] = 'Content-Type'
5
6cors = CORS(app, resources={r"/foo": {"origins": "http://localhost:port"}})
7
8@app.route('/foo', methods=['POST'])
9@cross_origin(origin='localhost',headers=['Content- Type','Authorization'])
10def foo():
11    return request.json['inputVar']
12
13if __name__ == '__main__':
14   app.run()
15