Guest User

Untitled

a guest
Oct 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. request(initialRequest, function (error, response, body) {
  2. if (error) throw error;
  3.  
  4. while (body.pagination.cursor) {
  5. let subsequentRequest = {
  6. url: `http://myurl.com&pagination=${body.pagination.cursor}`,
  7. method: "GET",
  8. json: true
  9. };
  10.  
  11. request(subsequentRequest, function (error, response, body) {
  12. if (error) throw error;
  13.  
  14. console.log("Still more");
  15. });
  16. }
  17.  
  18. res.json(body);
  19. });
Add Comment
Please, Sign In to add comment