Created
April 27, 2018 09:49
-
-
Save UsamaAshraf/2d821f63f9bc1f6b135e6801f3883216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# main.py | |
from flask import Flask | |
from flask import request | |
from flask import jsonify | |
from services.user_event_handler import emit_user_profile_update | |
app = Flask(__name__) | |
@app.route('/users/<int:user_id>', methods=['POST']) | |
def update(user_id): | |
new_name = request.form['full_name'] | |
# Update the user in the datastore using a local transaction... | |
emit_user_profile_update(user_id, {'full_name': new_name}) | |
return jsonify({'full_name': new_name}), 201 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment