From a2697b8a119d4f1e8be2825f5066207f4d793573 Mon Sep 17 00:00:00 2001 From: Sorrel Bri Date: Sat, 5 Oct 2019 23:17:13 -0700 Subject: [PATCH] config CORS for dev --- api/users/user_endpoint.py | 6 +++--- app.py | 4 ++-- models/User.py | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/users/user_endpoint.py b/api/users/user_endpoint.py index 7b89b6f..7d80d6e 100644 --- a/api/users/user_endpoint.py +++ b/api/users/user_endpoint.py @@ -1,7 +1,7 @@ -from models.User import User, user_schema +from models.User import User, user_schema, users_schema class UserEndpoint(object): def users(): - user = User.query.first() - response = user_schema.dumps(user) + user = User.query.all() + response = users_schema.dumps(user) return response diff --git a/app.py b/app.py index e1b6270..e2c5604 100644 --- a/app.py +++ b/app.py @@ -10,8 +10,8 @@ from flask_cors import CORS def create_app(): app = Flask(__name__) - CORS(app) - + CORS(app, origins="http://localhost:3004") + app.config['CORS_HEADERS'] = 'Content-Type' app.config.from_object(DevelopmentConfig) db.init_app(app) ma.init_app(app) diff --git a/models/User.py b/models/User.py index 203c25a..7fd6fff 100644 --- a/models/User.py +++ b/models/User.py @@ -106,7 +106,8 @@ class UserSchema(ma.ModelSchema): class Meta: fields = ( 'id', - 'name', + 'name', + 'email', 'registered_on', 'rank', 'rank_certainty',