Created
October 26, 2020 22:44
-
-
Save agustinustheo/d752af49018e6ff1ed573be7402183a5 to your computer and use it in GitHub Desktop.
Main Flask file already filled with endpoints ready to be executed.
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
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