From fc559027000600e8c8410d8aa56f553a829fb641 Mon Sep 17 00:00:00 2001 From: sasi Date: Thu, 30 May 2024 16:41:33 +0530 Subject: [PATCH] cors added - 2 --- app.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index a908206..a166b78 100644 --- a/app.py +++ b/app.py @@ -4,11 +4,13 @@ from flasgger import Swagger import re,os from utils import * -from flask_cors import CORS +from flask_cors import CORS,cross_origin app = Flask(__name__) -CORS(app, resources={r"/*": {"origins": "*"}}) +# CORS(app, resources={r"/*": {"origins": "*"}}) +CORS(app, support_credentials=True) + Swagger(app) @@ -33,7 +35,7 @@ re.compile(r'^/issues/[^/]+/[^/]+$') # Matches '/issues//' ] - +@cross_origin() # added this to my endpoint @app.route('/greeting', methods=['GET']) def greeting(): """ @@ -54,6 +56,7 @@ def greeting(): } return jsonify(response) +@cross_origin() @app.route('/get-data', methods=['GET']) def get_data(): """ @@ -82,7 +85,7 @@ def get_data(): return jsonify({'error': str(e)}), 500 - +@cross_origin() @app.route('/issues', methods=['GET']) def get_issues(): """ @@ -125,7 +128,8 @@ def get_issues(): except Exception as e: return jsonify({'error': str(e)}), 500 - + +@cross_origin() @app.route('/issues/', methods=['GET']) def get_issues_by_owner(owner): """ @@ -166,7 +170,7 @@ def get_issues_by_owner(owner): - +@cross_origin() @app.route('/issues//', methods=['GET']) def get_issues_by_owner_id(owner, issue): """