nl_tokens: Connect to mongodb & redis with the given connection urls . This should be called before start () is called
pl_tokens: function connect ( mongoDBConnectionUrl , mongoDBConnectionOption , redisUrl , cb ) { if ( arguments . length < 4 ) throw <mask> Error ( 'connect requires 4 arguments' ) ; async . series ( [ function connectToMongoDB ( callback ) { MongoClient . connect ( mongoDBConnectionUrl , mongoDBConnectionOption || { } , callback ) ; } , function connectToRedis ( callback ) { var redisOpts = { url : redisUrl } ; var client = redis . createClient ( redisOpts ) ; // We don't want the app to crash if Redis is not available. client . on ( 'error' , handleRedisError ) ; return callback ( null , client ) ; } ] , function ( err , results ) { if ( err ) { // If there was any problem with connecting to mongo or redis on startup, // the app should crash as its in an unknown state. throw err ; } var mongoDbClient = results [ 0 ] ; var redisClient = results [ 1 ] ; server . setClients ( mongoDbClient , redisClient ) ; syncConnected = true ; eventEmitter . emit ( 'sync:ready' ) ; return cb ( null , mongoDbClient , redisClient ) ; } ) ; }