javascript - make redis client available in route -


in app.js, have constructed redis client:

var redis = require('redis'),   redisclient = redis.createclient(6379, 'localhost');  ...  module.exports = {   app:app,   redisclient:redisclient } 

i need use redis client in other module, routes/index.js. here, tried including so:

var redisclient = require('../app').redisclient; 

unfortunatly, undefined. should require in index.js did in app.js, , create new instance here? or change make work?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -