Skip to content

Commit

Permalink
fixing flask cors
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusmota committed May 12, 2019
1 parent 5776e93 commit 0ad3e3d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self, broker, mongodb_collection):
self.broker = broker
self.mongodb_collection = mongodb_collection

@cross_origin()
def post(self):
message = request.get_json()
print(json.dumps(message))
Expand All @@ -45,6 +46,8 @@ def post(self):

return jsonify(data)


@cross_origin()
def get(self):
docs = self.mongodb_collection.find().sort([("timestamp", pymongo.DESCENDING)])

Expand All @@ -56,6 +59,8 @@ def get(self):

return jsonify({'execution_stream':items})


@cross_origin()
def delete(self):
self.mongodb_collection.delete_many({})
data = {"message":'Messages in the execution stream deleted successfully'}
Expand Down

0 comments on commit 0ad3e3d

Please sign in to comment.