I am getting this error on my code, and I don't know how to fix it ?
DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
My code so far:
router.post('/users/*', (req, res) => {
User.create(new User({
email: req.body.identity.user_email,
authUserId: req.body.identity.user_id
}))
res.json(console.log("User Created"))
})
router.get('/users/:id', (req, res, next) => {
User.findOne({authUserId: req.params.id}, (err, userr) => {
if(err) {
return next(err);
} else if (userr) {
res.json(userr.email);
} else {
res.json(null)
}
});
});
Can someone help me get rid of this error. Thnx in advance! :)
via Marketingexpert
No comments:
Post a Comment