progress-report / progress_report_server

Server code for the Progress Report Scorecard API
https://progress-report-server.herokuapp.com/api
2 stars 1 forks source link

Enable CORS for all API endpoints #15

Closed leesharma closed 7 years ago

leesharma commented 7 years ago

Fixes #14

This commit adds the Flask-CORS dependency to allow all cross-site requests on our API. There is no CORS testcase yet, but I wrote a stub and a note.

Here's a link to Flask-CORS:

https://flask-cors.readthedocs.io/en/latest/

TODO:

I didn't add a test case for cross-origin requests. I only had about 30 mins right now, and I couldn't get a valid test in that time. Since the front-end development relies on this feature, I think it's worth shipping now.

Alternate implementation:

Using Flask-CORS was quick and easy for now, but if we want to remove that dependency in the future, here's a code snippet showing how to add a crossdomain decorator:

http://flask.pocoo.org/snippets/56/