-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
34 lines (25 loc) · 864 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask
try:
from flask.ext.cors import cross_origin
except ImportError:
import os
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0, parentdir)
from flask.ext.cors import cross_origin
app = Flask(__name__)
@app.route("/", methods=['GET'])
@cross_origin()
def helloWorld():
return '''<h1>Index Page!</h1>'''
@app.route("/content", methods=['GET'])
@cross_origin(origins="http://localhost:8000")
def get_content():
print 'Get Content'
return '''<h1>My Content</h1>'''
@app.route("/contentPreflighted", methods=['GET'])
@cross_origin(origins="http://localhost:8000", allow_headers= "X-Test-Header")
def get_content_preflighted():
print 'Get Content Preflighted'
return '''<h1>My Content Preflighted</h1>'''
if __name__ == "__main__":
app.run(debug=True)