save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
db.lpush( 'entries', entryJSON, function(err) { if (err) return fn(err); fn(); } );
function save(badges, callback) { if (badges.length == 0) { console.log("runs/"); callback(null, null); } else { var badge = badges.pop(); redis.lpush("badges", JSON.stringify(badge), function(err, data) { if (err) { callback(err, null); console.log("error", err); } }); save(badges, callback); } }
app.post('/upload',[ multer({ dest: './uploads/'}), function(req, res){ if( req.files.image ){ fs.readFile( req.files.image.path, function (err, data) { if (err) { throw err; } var img = new Buffer(data).toString('base64'); // Store the image in a redis queue client.lpush('imageQueue',img) }); } res.status(204).end() }]);
///////////// WEB ROUTES // Add hook to make it easier to get all visited URLS. app.use(function(req, res, next) { client.lpush('queue',req.url) // Trimming the queue to hold only the most recent 5 entries. client.ltrim('queue',0,4) next(); // Passing the request to the next handler in the stack. });
redis.lpush('people', JSON.stringify(onePerson), function(err){ if (err) return callback (err, null) ; // saves one person at the time, recursively exports.save(people, callback); });
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
save(cb) { const entryJSON = JSON.stringify(this); db.lpush( 'entries', entryJSON, (err) => { if (err) return cb(err); cb(); } ); }
redis.lpush('badges', JSON.stringify(badge), function(err) { if (err) { return callback(err, null); } exports.save(badges, callback); });