using Promise.all() allows for the call of multiple get/list functions
example to get a list of buildings and a list of groups:
var list = require('../firebase/list');
//... things
// in your router.get function:
var firebaseData = {};
Promise.all([list("/buildings"), list("/groups")).then(function(snapshots) {
firebaseData.buildings = snapshots[0];
firebaseData.groups = snapshots[1];
res.render("a-template", firebaseData);
});
see
routes/device.js
for example usuageusing
Promise.all()
allows for the call of multipleget
/list
functionsexample to get a list of buildings and a list of groups: