Thursday, 8 June 2017

firebase.database.ref path syntax in Cloud Functions and Nodejs

// cloud functions
exports.listenOnWrite = functions.database.ref('/foo/{id}').onWrite(event => {
    console.log("did match....");
})

matches for example: /foo/123123 and /foo/jk3489

// node.js
function startLitener() {
  firebase.database().ref("/foo/{id}").on('child_added', function (postSnapshot) {
    console.log("did match....");
  });
};

does not match anything

1) question

I understand the very comfortable {} syntax in the ref path works only for cloud functions. Or did I miss something?

2) question

How would I formulate ref('/foo/{id}') on a nodejs server?



via stackovermat

No comments:

Post a Comment