For this exercise we will be building a simple application where we will store a shopping list. You should use an array to store your items in the shopping list.
Our application should have the following routes:
GET /- this should redirect to
GET /items- this should render a list of shopping items.
GET /items/new- this page should render a form where a user can add an item to their shopping list, with at least
priceattributes. When the form is submitted, the browser should make a
POST /items- this route should accept form data and add it to the shopping list.
Hint: you can solve these by looking ahead to RESTful Routing - the next lesson.
GET /items/:id- this route should display a single item's name and price
GET /items/:id/edit- this route should render a form where the user can update the name or price of the item, which sends a PATCH to
/items/:id, or click an
Xto delete the item, sending a DELETE to
PATCH /items/:id- this route should accept edits to existing items.
DELETE /items/:id- this route should allow you to delete a specific item from the array.
When you're ready, move on to RESTful Routing with Express