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