Change response to JSON
parent
2f9fac3540
commit
23303bdb3f
|
@ -1,11 +1,10 @@
|
||||||
from app import db
|
from app import db
|
||||||
from flask import request, current_app
|
from flask import request, jsonify, abort
|
||||||
from .models import Account, Role
|
from .models import Account, Role
|
||||||
|
|
||||||
def initialize_routes(accounts):
|
def initialize_routes(accounts):
|
||||||
@accounts.route("/", methods=['POST'])
|
@accounts.route("/", methods=['POST'])
|
||||||
def create():
|
def create():
|
||||||
with current_app.app_context():
|
|
||||||
print(request.data)
|
print(request.data)
|
||||||
user = request.data.get('user')
|
user = request.data.get('user')
|
||||||
acct = Account(user.get('username'),
|
acct = Account(user.get('username'),
|
||||||
|
@ -13,5 +12,9 @@ def initialize_routes(accounts):
|
||||||
user.get('email'),
|
user.get('email'),
|
||||||
2)
|
2)
|
||||||
acct.save()
|
acct.save()
|
||||||
return "Success!"
|
response = jsonify({
|
||||||
|
'message':'Success!'
|
||||||
|
})
|
||||||
|
response.status_code = 200
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue