var redis = require('redis');var client = redis.createClient(6379,'localhost'); //creates a new client
client.on('connect', function() {
console.log('connected');
});
client.hget("Hash","key", function(err, reply) {
console.log(reply);
});
This is program we are running in the node-red function node but we are getting error i.e.,
"Reference error: require is not defined (line1,col 13)
please help me out with this.
var redis = context.global.get('redis');
var client = redis.createClient(6379,'localhost'); //creates a new client
client.on('connect', function() {
console.log('connected');
});
client.hget("hash","key", function(err, reply) {
console.log(reply);
});```
I'm using this code now, I have debugged that require issue but now I'm getting different error i.e.,
"Type Error: Cannot read property 'create Client' of "undefined"