Change response to JSON
parent
2f9fac3540
commit
23303bdb3f
|
@ -1,17 +1,20 @@
|
||||||
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'),
|
user.get('password'),
|
||||||
user.get('password'),
|
user.get('email'),
|
||||||
user.get('email'),
|
2)
|
||||||
2)
|
acct.save()
|
||||||
acct.save()
|
response = jsonify({
|
||||||
return "Success!"
|
'message':'Success!'
|
||||||
|
})
|
||||||
|
response.status_code = 200
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue