Skip to content

Instantly share code, notes, and snippets.

@UsamaAshraf
Created April 27, 2018 09:49
Show Gist options
  • Save UsamaAshraf/2d821f63f9bc1f6b135e6801f3883216 to your computer and use it in GitHub Desktop.
Save UsamaAshraf/2d821f63f9bc1f6b135e6801f3883216 to your computer and use it in GitHub Desktop.
# 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