Step 2 - Get the Home Page to Render the Posts
Goal: When you go to localhost:3000 you should see the posts you created in the compose page.
Scroll down for a hint 👇
- You’ll need to delete the existing posts array.
let posts = [];
- You’ll need to find all the posts in the posts collection and render that in the home.ejs file.
Post.find({}, function(err, posts){
res.render("home", {
startingContent: homeStartingContent,
posts: posts
});
})
Download
0 comments