Hi,

There are several things here:

1 — maybe you should increase the timeout response from the clien call

2 — you should implement a paginate system (it is easy with “limit” and “skip” for mongo and an simple param in the request)

3 — maybe you can read the data with a buffer(like in the example in this article), build the array with the data and then send the response.

I recommend you to start with the second tip, it’s a good practice to paginate elements.

If you control the client too, you can implement the first tip.

And finally , try the third tip

--

Software engineer with 15 year of experience. Lately focused in Node.js ecosystem and good practices.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ángel Cereijo

Ángel Cereijo

85 Followers

Software engineer with 15 year of experience. Lately focused in Node.js ecosystem and good practices.