Skip to content

Instantly share code, notes, and snippets.

@agustinustheo
Created October 26, 2020 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustinustheo/535330ff6d4e76cb6a217b763e8c4007 to your computer and use it in GitHub Desktop.
Save agustinustheo/535330ff6d4e76cb6a217b763e8c4007 to your computer and use it in GitHub Desktop.
To-do service example for Flask-FaunaDB tutorial.
from flask import request, jsonify
from helpers import todo_helper
def get_all_todos():
try:
print(todo_helper.get_all_todos())
return jsonify(todo_helper.get_all_todos())
except Exception as ex:
raise ex
def get_todo_by_ref_id(id):
try:
return jsonify(todo_helper.get_todo_by_ref_id(id))
except Exception as ex:
raise ex
def create_todo():
try:
req_data = request.get_json()
return jsonify(todo_helper.create_todo(req_data))
except Exception as ex:
raise ex
def update_todo(id):
try:
req_data = request.get_json()
return jsonify(todo_helper.update_todo(id, req_data["data"]))
except Exception as ex:
raise ex
def delete_todo(id):
try:
return jsonify(todo_helper.delete_todo(id))
except Exception as ex:
raise ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment