Change response to JSON

master
esensar 2018-05-03 17:01:32 +02:00
parent 2f9fac3540
commit 23303bdb3f
1 changed files with 13 additions and 10 deletions

View File

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