Add basic CORS support
I don't really need it yet, but I had added it in as I was trying to sort out how to get the UI working with the API
This commit is contained in:
parent
7a3cfa95cd
commit
f766f8dfa4
|
@ -3,12 +3,17 @@ import uuid
|
||||||
import flask
|
import flask
|
||||||
import flask_login
|
import flask_login
|
||||||
import flask_uuid
|
import flask_uuid
|
||||||
|
import sepiida.cors
|
||||||
import sepiida.endpoints
|
import sepiida.endpoints
|
||||||
|
|
||||||
import vanth.api.about
|
import vanth.api.about
|
||||||
|
import vanth.api.session
|
||||||
import vanth.api.user
|
import vanth.api.user
|
||||||
import vanth.user
|
import vanth.user
|
||||||
|
|
||||||
|
EXPOSE_HEADERS = [
|
||||||
|
'Location',
|
||||||
|
]
|
||||||
|
|
||||||
def index():
|
def index():
|
||||||
return flask.render_template('index.html')
|
return flask.render_template('index.html')
|
||||||
|
@ -45,6 +50,12 @@ def create_app(config):
|
||||||
SECRET_KEY = config.secret_key,
|
SECRET_KEY = config.secret_key,
|
||||||
SESSION_COOKIE_DOMAIN = config.session_cookie_domain,
|
SESSION_COOKIE_DOMAIN = config.session_cookie_domain,
|
||||||
)
|
)
|
||||||
|
sepiida.cors.register_cors_handlers(
|
||||||
|
app,
|
||||||
|
domains=['localhost:8080', 'www.vanth.com'],
|
||||||
|
supports_credentials=True,
|
||||||
|
expose_headers=EXPOSE_HEADERS,
|
||||||
|
)
|
||||||
|
|
||||||
app.route('/', methods=['GET'])(index)
|
app.route('/', methods=['GET'])(index)
|
||||||
app.route('/login/', methods=['GET', 'POST', 'DELETE'])(login)
|
app.route('/login/', methods=['GET', 'POST', 'DELETE'])(login)
|
||||||
|
|
Loading…
Reference in New Issue