#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;

+ Recent posts