In firebase documentation I didn't find a simple way to get data from firebase db - only by events (.on, .once). Is this the only way?
In this case, to get data from different branches, I need to describe handler in handler? And response.send() must be in deepest handler?
Is this the correct function?
exports.test = functions.https.onRequest((request, response) => {
var db = admin.database();
db.ref("test/val").once("value", snap => {
var val1 = snap.val();
db.ref("test/val").set(val1+1);
db.ref("test2/val").once("value", snap => {
var val2 = snap.val();
response.send(val1+", "+val2);
});
});
//response.send("bad way");
});