var Jsonresult = {};
app.get('/trips', function(req1, res1) {
for (var i = 0; i < events.length; i++) {
var event = events[i];
var start = event.start.dateTime || event.start.date;
console.log('%s - %s', start, event.summary);
Jsonresult.event = event.summary;
Jsonresult.datetime = start;
res1.json([Jsonresult]);
}
res1.end();
}
I am getting events from google calendar. In console showing all events but In POSTMAN showing one data only. I want to get all results as json format but i am getting only one result from the forloop. Please help me.
I am expecting Results like:
[{
"event": "Daily Meeting",
"datetime": "2017-04-25T10:00:00+05:30"
},
{
"event": "Daily Call",
"datetime": "2017-06-26T10:00:00+05:30"
},
{
"event": "Office Meeting",
"datetime": "2017-05-27T10:00:00+05:30"
}]
But its showing only one result in POSTMAN like :
[{
"event": "Daily Meeting",
"datetime": "2017-04-25T10:00:00+05:30"
}]
via Ram Android
No comments:
Post a Comment