我收到的错误是: Connection to http://localhost:8081/debugger-proxy?role=client timed out. Are you running node proxy? If you are running on the device, check if you have the right IP address in RCTWebSocketExecutor.m
我已经尝试从localhost更改为我的计算机的IP地址,如其他stackoverflow帖子中所述,但它似乎仍然没有工作.
我正在尝试使用关键字访问存储在用户实例中的密码this,但它不起作用?
这是我打电话时的代码.
Users.find({where: {$or: [{ email: email} ,{ username: username }]}})
.then(user => {
if (!user) return res.status(401).send(new errors.Unauthorized('Email/Username or Password Not Found!'));
user.authenticate(password, (err, match) => {
if (err) return res.status(401).send(err);
res.send(user);
});
})
.catch(err => res.send(err));
Run Code Online (Sandbox Code Playgroud)
这是我的实例方法的代码.
instanceMethods :{
authenticate: (password, cb) => {
return bcrypt.compare(password, this.password, (err, match) => {
if (err) return cb(new errors.Unauthorized());
return cb(null, match);
});
}
}
Run Code Online (Sandbox Code Playgroud)