Goal: When you click on Read More, it should take you to the post.ejs page rendering the correct post using the post._id
Scroll down if you need a hint 👇
<a href="/posts/<%=post._id%>">Read More</a>
app.get("/posts/:postId", function(req, res){
}
const requestedPostId = req.params.postId;
Post.findOne({_id: requestedPostId}, function(err, post){ }
Post.findOne({_id: requestedPostId}, function(err, post){
   res.render("post", {
     title: post.title,
     content: post.content
   });
 });
0 comments