config CORS for dev
This commit is contained in:
parent
4287766d7f
commit
a2697b8a11
3 changed files with 7 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
from models.User import User, user_schema
|
from models.User import User, user_schema, users_schema
|
||||||
|
|
||||||
class UserEndpoint(object):
|
class UserEndpoint(object):
|
||||||
def users():
|
def users():
|
||||||
user = User.query.first()
|
user = User.query.all()
|
||||||
response = user_schema.dumps(user)
|
response = users_schema.dumps(user)
|
||||||
return response
|
return response
|
||||||
|
|
4
app.py
4
app.py
|
@ -10,8 +10,8 @@ from flask_cors import CORS
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app, origins="http://localhost:3004")
|
||||||
|
app.config['CORS_HEADERS'] = 'Content-Type'
|
||||||
app.config.from_object(DevelopmentConfig)
|
app.config.from_object(DevelopmentConfig)
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
ma.init_app(app)
|
ma.init_app(app)
|
||||||
|
|
|
@ -107,6 +107,7 @@ class UserSchema(ma.ModelSchema):
|
||||||
fields = (
|
fields = (
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
|
'email',
|
||||||
'registered_on',
|
'registered_on',
|
||||||
'rank',
|
'rank',
|
||||||
'rank_certainty',
|
'rank_certainty',
|
||||||
|
|
Loading…
Reference in a new issue