Skip to content

Commit

Permalink
Enable CORS on feedback service (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliok authored Oct 4, 2023
1 parent 7ce9d56 commit 27aa2c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions services/feedback-service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from cloudevents.conversion import to_binary
from cloudevents.http import CloudEvent
from flask import Flask, request
from flask_cors import CORS, cross_origin

K_SINK = os.environ.get("K_SINK")
SOURCE_DECLARATION = os.environ.get("SOURCE_DECLARATION")
Expand All @@ -28,9 +29,12 @@ def handler(signal, frame):
signal.signal(signal.SIGTERM, handler)

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'


@app.route("/", methods=["POST"])
@cross_origin()
def receive_feedback():
# request body looks like this:
# {
Expand Down
1 change: 1 addition & 0 deletions services/feedback-service/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ flask==2.3.2
cloudevents==1.10.0
requests==2.31.0
gunicorn==21.2.0
flask-cors==4.0.0

0 comments on commit 27aa2c3

Please sign in to comment.