When i send a request to "check-status1" i am able to get data at "fire-test" location. Once i send a request to "check-status2" i get an exception (Exception: Error: Can't set headers after they are sent). After that if i again send request to check-status1 i am not getting any response in success callback and even it is not entering into falilure callback but node able to serve for other non firebase related stuff (like email sending ).
Why firebase not responding after getting the above exception?
app.get('/check-status1', function (req, res) {
FirebaseRef.child('fire-test').once('value', function (snapShot) {
res.send(JSON.stringify(snapShot.val()));
}, function (err) {
console.log(err);
});
});
app.get('/check-status2', function (req, res) {
FirebaseRef.child('fire-test').once('value', function (connectedSnap) {
console.log(connectedSnap.val());
res.send(JSON.stringify(connectedSnap.val()));
}, function (err) {
console.log(err);
});
res.end(JSON.stringify({"success":true}));
});