Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Commit

Permalink
Add CORS headers to all routes
Browse files Browse the repository at this point in the history
  • Loading branch information
RitwikGupta committed Feb 28, 2017
1 parent d81f071 commit d598630
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apiwrapper/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
'''
from flask import Flask, make_response
from flask_restful import Api, Resource
from flask_cors import CORS, cross_origin
from .PittAPI.PittAPI import course, lab, laundry, people, shuttle, textbook, news
import json

app = Flask(__name__)
CORS(app)
api = Api(app)


@api.representation('application/json')
def output_json(data, code, headers=None):
"""Makes a Flask response with a JSON encoded body"""
Expand Down Expand Up @@ -135,8 +136,6 @@ def get(self, feed, max_news_items):
return {'error': str(e)}




api.add_resource(CourseGetAPI, '/courses/<term>/<code>')
api.add_resource(ClassAPI, '/class/<class_number>/<term>')
api.add_resource(LabStatusAPI, '/lab_status/<lab_name>')
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ beautifulsoup4
nose
nose-cov
nose-timer
flask-cors

0 comments on commit d598630

Please sign in to comment.