I'm building a wrapper for a REST API in Node.js (7.10).
The REST API can only return 300 items at once (per call) but sets moreItems
to true
in the JSON response. As you sometimes need to fetch a lot of data from the API (> 10000), I need to (or can, if needed) call the same endpoint until moreItems
equals false
.
So, in my API wrapper I want to offer an easy way to iterate over all that data. I was thinking of using an ES6 iterator for this that would allow them to use .next()
to iterate.
But since I'm fairly new to Node.js, I'm wondering if Node streams would be better suited in this case?
via Daniel
No comments:
Post a Comment