Skip to content

Instantly share code, notes, and snippets.

Created Oct 26, 2020
What would you like to do?
Main Flask file already filled with endpoints ready to be executed.
from services.todo_service import get_all_todos, get_todo_by_ref_id, create_todo, update_todo, delete_todo
from flask import Flask
app = Flask(__name__)
app.add_url_rule('/api/todos', methods=['GET'], view_func=get_all_todos)
app.add_url_rule('/api/todos', methods=['POST'], view_func=create_todo)
app.add_url_rule('/api/todos/<string:id>', methods=['GET'], view_func=get_todo_by_ref_id)
app.add_url_rule('/api/todos/<string:id>', methods=['PUT'], view_func=update_todo)
app.add_url_rule('/api/todos/<string:id>', methods=['DELETE'], view_func=delete_todo)
if __name__ == "__main__":'')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment