#DESTROYYYYY
* Add Destroy Route
* Add Edit and Destroy Links
1. Add DELETE ROUTE
1) Use delete method
2) connection test
3) find and remove
Blog.findByIdAndRemove(req.params.id, err => {
4) redirect page to the "/blogs" either success or not
(normally it should've had "fail page(Opps.. something is wrong....")
2. Edit show.ejs
1) Create button for destroy with DELETE method
2) Create edit <a> (or you can also use <form method="GET"> because EDIT is declared as "get method "
3. Design show.ejs
1) <a> and <button> are block level elements (cannot stay in same line)
2) use app.css (customised css) for display: inline;
'Full stack development > The Web Developer Bootcamp(2020)' 카테고리의 다른 글
322. RESTful Blog App: Final Touches (0) | 2020.10.01 |
---|---|
321. Note about RESTful Blog App: Final Touches (0) | 2020.10.01 |
319. RESTful Blog App : EDIT AND UPDATE (0) | 2020.10.01 |
318. RESTful Blog App: SHOW (0) | 2020.10.01 |
317. Note about RESTful Blog App: SHOW (0) | 2020.10.01 |