这是我的代码如何返回User Exist而不是Exist。谢谢oyu
exports.create=(req, res)=>{
let registration=req.body.email;
User.findOrCreate({
where: {
email: registration
}
}).spread((user,created)=>{
console.log(user.get({
plain: true
}))
})
console.log(created)
};
答案 0 :(得分:0)
exports.create=(req, res)=>{
let registration=req.body.email;
User.findOrCreate({
where: {
email: registration
}
}).spread((user,created)=>{
if (created){
res.send({ message: "user Created Successfully" });
}
else {
res.send({ message: "user Already exists" });
}
})
console.log(created)
};
有关更多详细信息,请阅读此文档link