I checked this How do I define global variables in CoffeeScript? for declaring a global variable i.e., declaring in the app.js and accessing in the routes/index.coffee
I declared (exports ? this).db = redis.createClient() in the app.coffee and tried to access the db in the routes.index.coffee using db.set('online',Date.now(), (err,reply) -> console.log(reply.toString()) ) this doesn't seem to work...what is happening..I am on node 0.8.9
There are other approaches in which it works but curious to know what is happening... Also tried the @db = redis.createClient() in the app.coffee which doesn't work either
Thanks