redis.js 466 Bytes
const  redis = require('redis');
const  bluebird = require('bluebird');
const  config = require('../config/config');
let client;

try {
    client = redis.createClient(config.redis.connect);

    bluebird.promisifyAll(redis.RedisClient.prototype);
    bluebird.promisifyAll(redis.Multi.prototype);

    client.on('error', function() {
        console.log('redis error');
        client = '';
    });
} catch (e) {
    client = '';
}


module.exports = {
    client
}