-
Notifications
You must be signed in to change notification settings - Fork 0
/
todolist-app.py
31 lines (23 loc) · 960 Bytes
/
todolist-app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask
from flask_restful import Api
from config import AUTH_URLS, TASK_URLS
import controller
app = Flask(__name__)
api = Api(app)
# ERROR HANDLERS
@app.errorhandler(404)
def invalid_route(e):
return {'message': 'Invalid route.', 'code': 404} , 404
# ENDPOINTS
api.add_resource(controller.AuthRegister,AUTH_URLS['AuthRegister'])
api.add_resource(controller.AuthLogin,AUTH_URLS['AuthLogin'])
# AUTH NEEDED ENDPOINTS
api.add_resource(controller.TaskList,TASK_URLS['TaskList'])
api.add_resource(controller.TaskCreate,TASK_URLS['TaskCreate'])
api.add_resource(controller.TaskView,TASK_URLS['TaskView'])
api.add_resource(controller.TaskUpdate,TASK_URLS['TaskUpdate'])
api.add_resource(controller.TaskDelete,TASK_URLS['TaskDelete'])
api.add_resource(controller.TaskSetSortIndex,TASK_URLS['TaskSetSortIndex'])
api.add_resource(controller.TaskSetSortBulk,TASK_URLS['TaskSetSortBulk'])
if __name__ == "__main__":
app.run(debug=True)