【发布时间】:2018-06-08 15:30:39
【问题描述】:
我需要帮助才能将我的 Firebase 数据库中的数据以 JSON 格式显示到浏览器控制台日志中。 我只想将 Product 加载到浏览器控制台中。我找到了从this link 推送数据的代码。谁能帮我弄清楚这个功能吗?
var firebase = require('firebase');
//var admin = require('firebase-admin');
firebase.initializeApp({
apiKey: "...",
authDomain: "xxx.firebaseapp.com",
databaseURL: "https://xxx.firebaseio.com",
projectId: "xxx",
storageBucket: "xxx.appspot.com",
messagingSenderId: "xxx"
})
var ref = firebase.database().ref('Product');
//it's child directory
var messageRef = ref.child('/');
/*messageRef.push
({
prdName: 'node1',
prdCategory: 'node1',
prdSup: 'node1',
prdDescription: 'node1',
prdImage: 'test1.jpg',
prdUrl: 'https://firebasestorage.googleapis.com/v0/b/ng-product.appspot.com/o/Uploads%2Ftest1.jpg?alt=media&token=f105332a-02c8-46ca-a639-745eda0e118c'
})*/
console.log('Product');
【问题讨论】:
-
json.stringify
标签: javascript json node.js firebase firebase-realtime-database