Skip to content

Instantly share code, notes, and snippets.

@robert8138
Last active August 12, 2018 05:06
Show Gist options
  • Save robert8138/975f8af226fe1f01b2c9 to your computer and use it in GitHub Desktop.
Save robert8138/975f8af226fe1f01b2c9 to your computer and use it in GitHub Desktop.
# API endpoints
@webapp.route('/api/all')
def api_all():
events = Events.query.all()
return jsonify(json_list = [event.serialize() for event in events])
@webapp.route('/api/<event_type>')
def api_by_event_type(event_type):
events = Events.query.filter_by(event_type = event_type).all()
return jsonify(json_list = [event.serialize() for event in events])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment