university-final-iot-backend/app/mod_accounts/controllers.py

21 lines
573 B
Python
Raw Normal View History

2018-05-03 14:40:30 +00:00
from app import db
2018-05-03 15:01:32 +00:00
from flask import request, jsonify, abort
2018-05-03 14:40:30 +00:00
from .models import Account, Role
def initialize_routes(accounts):
@accounts.route("/", methods=['POST'])
def create():
2018-05-03 15:01:32 +00:00
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
2018-05-03 14:40:30 +00:00