Skip to content

Commit

Permalink
Improved hello world to include JSON response and request
Browse files Browse the repository at this point in the history
  • Loading branch information
david4096 committed Jul 29, 2016
1 parent 20c5c0e commit 3784e5f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python_scripts/app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from flask import Flask
app = Flask(__name__)
import flask
app = flask.Flask(__name__)

@app.route("/")
def hello():
return "Hello World!"

@app.route("/bye")
@app.route("/bye", methods=["POST"])
def bye():
return "bye World!"
name = flask.request.get_json()['name']
response = {}
response['message'] = "bye {}!".format(name)
return flask.jsonify(response)

if __name__ == "__main__":
app.debug = True # helps us figure out if something went wrong
app.run()

0 comments on commit 3784e5f

Please sign in to comment.