#!/usr/bin/env python3 ''' example_flask_app.py Jeff Ondich, 22 April 2016 A slightly more complicated Flask sample app than the "hello world" app found at http://flask.pocoo.org/. ''' import flask import json app = flask.Flask(__name__) @app.route('/') def hello(): return 'Hello, Citizen of CS257.' @app.route('/authors/') def get_author(author): ''' What a dopey function! But it illustrates a Flask route with a parameter. ''' if author == 'Twain': author_dictionary = {'last_name':'Twain', 'first_name':'Mark'} else: author_dictionary = {'last_name':'McBozo', 'first_name':'Bozo'} return json.dumps(author_dictionary) if __name__ == '__main__': app.run(host='localhost', port=5000)