todos.js
Opened this issue · 0 comments
This is the todo controller
line 1 & 2
Requires the express package and sets the router
line 3
connects to the data.js
line 6 - 11
Index route "/" and renders the todos/index handlebars page
lines 14- 16
The new route and renders the todos/new handlebars
lines 19 -30
the show route. Shows one ID of the database. Renders the todos/show handlebars page
lines 33 - 38
The post route. Connects the new and show with the body parser package.
pushes from new to the active database. Redirects to the todos/index page
lines 41 - 49
The edit route. Takes an ID and allows you to edit the item in the array with the ID declared in the url. renders the todos/edit handlebars page.
Lines 52-59
The Update route. This updates any editing done the database. Redirects to the index page
Lines 63 - 67
The Delete router. Removes a database item from the array based on the ID and Deletes it. Redirects to the index page
Lines 71:
Exports the controller