@app.route('/v1/user', methods=['POST'])
def create_user():
    try:
        user = User.query.filter((User.user_name == request.form.get('user_name'))).first()
        if (user and user.user_name):
            raise Exception('User exist!')
        user = user_schema.load(request.form)
    except ValueError as errors:
        resp = jsonify(errors.messages)
        resp.status_code = 400
        return resp
    user.user_name = slugify(request.form.get('user_name'))
    db.session.add(user)
    db.session.commit()
    location = url_for('get_user', id=user.id)
    resp = jsonify({'message': 'created'})
    resp.status_code = 201
    resp.headers['location'] = location
    return resp
@app.route('/v1/user', methods=['POST'])
def create_user():
    try:
        user = User.query.filter((User.user_name == request.form.get('user_name'))).first()
        if (user and user.user_name):
            raise Exception('User exist!')
        user = user_schema.load(request.form)
    except ValueError as errors:
        resp = jsonify(errors.messages)
        resp.status_code = 400
        return resp
    user.user_name = slugify(request.form.get('user_name'))
    db.session.add(user)
    db.session.commit()
    location = url_for('get_user', id=user.id)
    resp = jsonify({'message': 'created'})
    resp.status_code = 201
    resp.headers['location'] = location
    return resp