from bananagram import app app.run(debug=True)
def find(): """ This is the view function to show all of the words. """ if request.method == 'GET': return redirect(url_for('index')) if request.method == 'POST': string = request.form['string'] word_list = get_word_list(string) context = dict( word_list=word_list, string=string) return render_template('index.html', word_list=word_list, string=string) if __name__ == '__main__': # Generate the node on server startup app.run() @app.route('/api', methods=['GET']) def api(): """ This is the API endpoint for the application. The API outputs JSON that looks like this: {"word_list": ["he", "hole", "oh"], "string": "hello"} The API supports sorting by alphabetical order and by size. To sort by alphabetical order (asc/desc): http://localhost:5000/api?string=computer&alpha=asc