-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from AnggieAlava/bug/1542
Added a solution.hide.py with the guide code, and corrected repeated …
- Loading branch information
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from flask import Flask, jsonify, request | ||
app = Flask(__name__) | ||
|
||
todos = [{"label": "A dummy todo", "done": True}] | ||
|
||
|
||
@app.route('/todos', methods=['GET']) | ||
def hello_world(): | ||
return jsonify(todos) | ||
|
||
|
||
@app.route('/todos', methods=['POST']) | ||
def add_new_todo(): | ||
request_body = request.json | ||
print("Incoming request with the following body", request_body) | ||
return 'Response for the POST todo' | ||
|
||
|
||
# These two lines should always be at the end of your app.py file | ||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=3245, debug=True) |
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