Last active
August 12, 2018 05:06
-
-
Save robert8138/975f8af226fe1f01b2c9 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
# 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