I tried install redis client in system and run node js code its working fine. but I tried to redis client configure to set host and port in node js.but its not connected its throwing connection refused error.how to resolve it any one give suggestion.
cache.js
//Import redis
const redis = require('redis');
const { promisify } = require('util');
const host = "127.0.0.1"
const port = 6379
//Connecting redis client
const client = redis.createClient(port,host,redis)
client.on('connect', function () {
console.log("Redis Connected")
});
client.on('error', function (err) {
console.log(err)
});
{ Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 at Object._errnoException (util.js:1022:11) at _exceptionWithHostPort (util.js:1044:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14) code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 6379 }