I want to send multiple data in firebase realtime db using nodejs, express npm but single data is coming.
ref.on("value", snapshot => {
snapshot.forEach(child => {
var deger=snapshot.val();
var notiKey = child.key;
var notiVal = child.val();
console.log(notiVal);
app.get('/', (req, res) => {
res.send(notiVal);
})
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
})
Console output of this code
{ body: 'testbody1', status: '1', title: 'test1' }
{ body: 'testbody2', status: '1', title: 'testtitle2' }
{ body: 'test3body', status: '1', title: 'testtitle3' }
{ body: 'bodytest5', status: '1', title: 'ester test 5' }
{ body: 'body6', status: '1', title: 'test6' }
{ body: 'Ester Deneme 3', status: '1', title: 'Deneme3' }
Example app listening on port 3000
output from localhost(127.0.0.1:3000)
{"body":"testbody1","status":"1","title":"test1"}
As you can see, it only receives the first data and other data does not come.
How can I send all data like console output?