Skip to content

Instantly share code, notes, and snippets.

Avatar

Colton Baker Southern

  • NC, USA
View GitHub Profile
View connectRedis.js
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 ) {
View gist:3642328
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);
You can’t perform that action at this time.