Skip to content

Instantly share code, notes, and snippets.

@burkeholland
Created July 22, 2021 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burkeholland/efcf2bc7fd9a3d84ecd9756f83f97551 to your computer and use it in GitHub Desktop.
Save burkeholland/efcf2bc7fd9a3d84ecd9756f83f97551 to your computer and use it in GitHub Desktop.
Sample Code For Hasan
router.post('/pug/found', function(req, res, next){
if(!req.body.user.email){
return res.status(422).json({errors: {email: "can't be blank"}});
}
const pug = new LostPug(req.body.pug);
return pug.save().then(function(){
console.log(lostPug);
return res.json({pug: JSON.stingify(pug)}); // in the video, change the "stingify" to "stringify"
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment