At the moment, when you compose a post and redirect to the root route, sometimes the post is not yet saved and doesn’t show up on the home page.

Goal: Add a callback to the save method to only redirect to the home page once save is complete with no errors.

Scroll down if you need a hint 👇



























 post.save(function(err){

   if (!err){

     res.redirect("/");

   }

 });