Vegetables Continued
CRUD, MVC, REST, INDUCES and JSX: Remember where we are going
Learning Objectives
- Practicing index and show, new and create routes with express
Prerequisites
- JavaScript
- Express
- Node
- JSX
Build a Vegetable App with JSX-VIEW-ENGINE
- Continue Vegetables App
Steps
- Create Edit, Update, and Delete routes for Vegetables
- Add method-override
- Create Edit
jsxViews and update Show.jsx to use delete and update - Add 5 Vegetables using your New Page
- Go to
http://localhost:3000/vegetables/new - Create a new
vegetable - See the vegetables at
http://localhost:3000/vegetables - Make sure the Show page for vegetable works
- make sure you can see vegetables in your MongoDB Atlas DB vegetables database
- Edit & Delete various vegetables to ensure functionality works
The User Stories
- When a user goes to the
/vegatablesroute they will see anindexof veggies on the page - When a user clicks on the name of the vegetable, they will be taken to that vegetable's
showpage, and will see the vegatables's name and color and if its READYTOEAT and buttons to delete or edit the vegetable. - When a user goes to
/vegetables/newa user sees a form that allows them to create a brand new vegetable, and then redirects the user back to/vegetables - When a user goes to
/vegetables/:id/edita user sees a form that allows them to update a pre-existing vegetable, and then redirects the user back to/vegetables/:idShow page for that fruit
Hints
/views/fruits/Index.jsx
/views/vegetables/Index.jsx
res.render('vegetables/Index', {...})
res.render('fruits/Index', {...})