Skip to content

Instantly share code, notes, and snippets.

REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379'; // global const for redis
var connection = require("url").parse(REDIS_URL); // parse redis url
REDIS_PARAMS = {}; // global const for redis connection settings, also used by socket.io
REDIS_PARAMS.port = connection.port;
REDIS_PARAMS.host = connection.hostname;
// connect to redis so we can put the express session there
var client = redis.createClient(REDIS_PARAMS.port, REDIS_PARAMS.host);
if ( connection.auth ) {
@Southern
Southern / gist:3642328
Created September 5, 2012 18:42 — forked from garrettwilkin/gist:3642279
What the scope?
function findHandler(err, docs) {
if (!err) {
// Return Success & JSON Content-type
var length = docs.length;
writeMeta(self.res,200,url,length);
// Process results from Mongo
docs.forEach(function(e,i,a) {
//console.log(e,i,a);