I am building a data sync backend service that serves a large amount of data to low RAM android clients in under 3 mins. Currently, we have paginated APIs that we iterate over however, I was hoping to stream data to android clients using Node.js but not sure what the best way forward is.
result.forEach((arrayOfMerchants) => {
res.write(JSON.stringify({
status: 200,
response: arrayOfMerchants,
message: 'SUCCESS!!',
}));
});
res.end();
But it's not cutting it, any help would be appreciated. I would love to stream data in chunks so that we send one request and response in chunks. The code above returns the whole object.