Skip to content

Commit

Permalink
Merge pull request #6 from Code4GovTech/sasi_dev
Browse files Browse the repository at this point in the history
cors added - 2
  • Loading branch information
VedantKhairnar authored May 30, 2024
2 parents 0c387cc + fc55902 commit 3795e9c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -33,7 +35,7 @@
re.compile(r'^/issues/[^/]+/[^/]+$') # Matches '/issues/<owner>/<issue>'
]


@cross_origin() # added this to my endpoint
@app.route('/greeting', methods=['GET'])
def greeting():
"""
Expand All @@ -54,6 +56,7 @@ def greeting():
}
return jsonify(response)

@cross_origin()
@app.route('/get-data', methods=['GET'])
def get_data():
"""
Expand Down Expand Up @@ -82,7 +85,7 @@ def get_data():
return jsonify({'error': str(e)}), 500


@cross_origin()
@app.route('/issues', methods=['GET'])
def get_issues():
"""
Expand Down Expand Up @@ -125,7 +128,8 @@ def get_issues():

except Exception as e:
return jsonify({'error': str(e)}), 500


@cross_origin()
@app.route('/issues/<owner>', methods=['GET'])
def get_issues_by_owner(owner):
"""
Expand Down Expand Up @@ -166,7 +170,7 @@ def get_issues_by_owner(owner):




@cross_origin()
@app.route('/issues/<owner>/<issue>', methods=['GET'])
def get_issues_by_owner_id(owner, issue):
"""
Expand Down

0 comments on commit 3795e9c

Please sign in to comment.