Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codespace literate space engine 5gvrjvg9j45wfvqjw #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
flask = "*"

[dev-packages]

[requires]
python_version = "3.10"
python_full_version = "3.10.12"
136 changes: 136 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from flask import Flask, jsonify, request
app = Flask(__name__)

todos=[ { "label": "My first task", "done": False } ]
@app.route('/todos', methods=['GET'])
def hello_world():
json_text = jsonify(todos)
return json_text

@app.route('/todos', methods=['POST'])
def add_new_todo():
request_body = request.json
print("Incoming request with the following body", request_body)
todos.append(request_body)
return jsonify(todos)

@app.route('/todos/<int:position>', methods=['DELETE'])
def delete_todo(position):
print("This is the position to delete:", position)
todos.pop(position)
return jsonify(todos)

if __name__ == '__main__':
app.run(host='0.0.0.0', port=3245, debug=True)