Created
June 19, 2016 11:05
-
-
Save aidataguy/a05f628c649a81aae757945c352a8392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Destroy Route (need to work on Destroy) | |
app.post("/blogs/:id", function (req, res) { | |
/* body... */ | |
// destroy Blog | |
Blog.findByIdAndRemove(req.params.id, function (err) { | |
/* body... */ | |
if (err) { | |
res.redirect("/blogs"); | |
}else { | |
res.redirect("/blogs"); | |
} | |
}) | |
// redirect somewhere | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="ui main text container segment"> | |
<div class="ui huge header"><%= blog.title %></div> | |
<div class="ui top attached "> | |
<div class="item"> | |
<img src="<%= blog.image %>" alt="<%= blog.title %>" class="ui centered rounded image"> | |
</div> | |
<div class="content"> | |
<span><%= blog.created.toDateString() %></span> | |
</div> | |
<div class="description"> | |
<p><%= blog.body %></p> | |
</div> | |
<form action="/blogs/<%= blog._id %>?_method=DELETE" method="POST"> | |
<button class="ui red basic big button">Delete</button> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment