Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
User promise
exports.createOrAddUserPromise = (req, res, next) => {
.then(user => {
if (user) {
const existingUser = new User(user);
return newUser.updatePromise(req.body)
const newUser = new User();
return newUser.savePromise(req.body);
.then(data => res.send(data))
.catch(e => next(e));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment