Skip to content

Instantly share code, notes, and snippets.

@agustinustheo
Created October 26, 2020 22:44
Show Gist options
  • Save agustinustheo/d752af49018e6ff1ed573be7402183a5 to your computer and use it in GitHub Desktop.
Save agustinustheo/d752af49018e6ff1ed573be7402183a5 to your computer and use it in GitHub Desktop.
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__":
app.run(host='0.0.0.0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment