This is Part 4 of a series of labs working towards building your first full stack web app.
- Part 1 - TDD todo list
- Part 2 - Mongo todo list
- Part 3 - Express todo list pt1
- Part 3.1 - Mocha, Chai and Supertest todo list (Optional)
- Part 4 - (this repo)
- Part 5 - Multi Model todo list
- Part 6 - Users todo list
So far you've built a TODO list Express JSON API and that's awesome! Now we're going to take it in another direction and instead of returning JSON data, you're going to render views using handlebars
.
Don't forget that you'll need to use Method Override for you update and delete forms.
You'll need to the following routes and functionality:
/
Should render andhandlebars
Landing Page for your website (renders: views/index.ejs)/todos
Should render anhandlebars
index page that lists the names and ids of all todos (renders: views/todos/index.ejs)/todos/new
Should render anhandlebars
page with a form that submits a POST requests to create the todos (renders: views/todos/new.ejs)POST /todos
Should create a new Todo with the submitted form data then res.redirect to the show page (/todos/:id) for the newly created todo./todos/:id
Should render anhandlebars
page that display the full details for the specified TODO (id equal to the req.params.id)./todos/:id/edit
Should render ahandlebars
page with a form that when submitted sends a PUT requests to update the specific TODO (renders: views/todos/edit.ejs)PUT /todos/:id
Should update the specified TODO with the submitted form data then res.redirect to the show page (/todos/:id) for the newly created todoDELETE /todos/:id
Should delete the specified TODO then res.redirect to the index page (/todos)
Include different CSS frameworks in your project and use it to style your website.
- Redirect to the index page if a Todo cannot be found on the show, edit, update and destroy routes
- Add buttons and links to your pages, so you don't need to type anything into the URL
- Pre-populate the Edit Form with the data from the Todo you are editing