Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

360 - Step 3 Fix the bug.html 821 B

You have to be logged in to leave a comment. Sign In
1
  1. <p>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. </p><p>Goal: Add a callback to the save method to only redirect to the home page once save is complete with no errors.</p><p>Scroll down if you need a hint 👇</p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><ul><li><p>You’ll need to add a call back to the mongoose save() method.</p></li></ul><p><br></p><p>  post.save(function(err){</p><p>    if (!err){</p><p>      res.redirect("/");</p><p>    }</p><p>  });</p><p><br></p>
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...