I am new to nodejs, but I already have a working js client program in Firebase version 3.0.2. Turns out I need a server to do some simple things that are not possible in the 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 work without 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");
Data is loaded into the database, and this is trying to look at the root. When I add items to the database through the console, nothing happens anyway. More specific ref () values ββare not affected.
I am using node version v4.4.4. The program is invoked on the command line (on MBP / OSX) with "node server.js".
I spent hours trying to figure out what I was doing wrong - probably something stupid! Thank you for your help.
DavidG
source share