I am new to nodejs, but have already a working js client program, in Firebase Version 3.0.2. It turns out I need a server for doing some simple things not possible in a js client.
When I try this basic thing in nodejs, nothing happens - the data in the database is never retrieved, and the node server program continues to run with no errors. The server program (server.js) is as follows:
var firebase = require("firebase");
var myApp =firebase.initializeApp({
serviceAccount: "xxx/xxx.json",
databaseURL: "https://xxx.firebaseio.com"
});
firebase.database().ref().on('value', function(snapshot) {
console.log("urls value changed"); // NEVER GETS HERE
console.log(snapshot.val());
});
The database is loaded with data, and this is trying to look at the root. When I add items to the database via the console, still nothing happens. More specific ref() values has no effect.
I'm using node version v4.4.4. The program is invoked at the command line (on a MBP/OSX) with "node server.js".
I have spent hours trying to figure out what I am doing wrong - probably something stupid! Thanks for help in advance.