node -v : 8.1.2
I use redis client node_redis with node 8 util.promisify , no blurbird.
the callback redis.get is ok, but promisify type get error message
If you are using node v8 or higher, you can promisify node_redis with util.promisify as in:
const {promisify} = require('util'); const getAsync = promisify(client.get).bind(client); // now getAsync is a promisified version of client.get: // We expect a value 'foo': 'bar' to be present // So instead of writing client.get('foo', cb); you have to write: return getAsync('foo').then(function(res) { console.log(res); // => 'bar' });
or using async await:
async myFunc() { const res = await getAsync('foo'); console.log(res); }
culled shamelessly from redis official repo