From c2c051e06f04268686874b574466cb952492a2e3 Mon Sep 17 00:00:00 2001 From: Nicolas Garnier Date: Mon, 25 Jan 2016 17:22:47 +0100 Subject: [PATCH] Update to the lastmodified-tracking sample. --- lastmodified-tracking/index.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/lastmodified-tracking/index.js b/lastmodified-tracking/index.js index 6e9a606..4af3164 100644 --- a/lastmodified-tracking/index.js +++ b/lastmodified-tracking/index.js @@ -17,20 +17,10 @@ var Firebase = require('firebase'); var env = require('./env'); -var ref = new Firebase(env.get('firebase.database.url')); +var ref = new Firebase(env.get('firebase.database.url'), 'admin'); +ref.auth(env.get('firebase.database.token')); -function touch(context) { - ref.auth(env.get('firebase.database.token'), function(error) { - if (error) { - context.done(error); - } else { - console.log('Authenticated successfully with admin rights'); - ref.child('lastmodified').set(Firebase.ServerValue.TIMESTAMP); - context.done(); - } - }); -} - -module.exports = { - touch: touch -} \ No newline at end of file +exports.touch = function(context) { + console.log('Authenticated successfully with admin rights'); + ref.child('lastmodified').set(Firebase.ServerValue.TIMESTAMP, context.done); +}; \ No newline at end of file