Closed kanian closed 4 years ago
Thank you Kanian.
You are welcome @amchavan
if your node version is newer,for example v10.15.0, you can fix it like following:
This is my code:
protectedResource.js
nosql.find().make( function(filter) {
filter.where('access_token', '=', inToken);
filter.callback(function (err, token) {
if (token) {
console.log("We found a matching token: %s", token);
req.access_token = token[0];
} else {
console.log('No matching token was found.');
}
next();
});
});
Should be fixed by #44 .
To anybody going through the exercises after node v10.0.0,
nosql v3.0.3, used in the code exercises, has a bug in FileReader.prototype.open in index.js line 2388. The callback in fs signature is no longer optional since v7.0.0 and throws an error since node v10.0.0 However, newer versions of nosql, have a different API than the one used in the exercises code. A quick fix, just to follow the exercises: in the node_modules/nosql/index.js, at line 2388, change
fs.close(fd);
tofs.close(fd, err=>{console.log(err)});
Cheers