我正在通过发送SMS在Node Js和MongoDB中创建一个项目。我尝试创建一个会话,当我运行链接时,在邮递员中遇到了以上错误。
我使用了following文档来创建会话。
user.model.js
var mongoose = require('mongoose');
var userSchema = new mongoose.Schema(
{
name: {type: String, required: true},
mobile: {type: String, required: true, unique:true, trim: true, sparse: true},
password: {type: String, required: true, min: 6},
is_verified:{type: Boolean, default:false}, // By given SMS OTP
},
{
timestamps:true
});
mongoose.model('User', userSchema);
module.exports = mongoose.model('User');
控制器
router.post("/register", upload.single('image'), function (req, res, next)
{
var args1 = {username:'username',password:'password'};
var args = {message:'Your Number is 1234', recipients:'94717434990'};
soap.createSession(url, function(err,client)
{
if(err)
console.error(err);
else
{
client.createSession(args1,args,function(err, response)
{
if(err)
console.error(console.log(err));
else
{
console.log("The response : " + response);
res.send(response);
}
})
}
});
})