Guest User

Untitled

a guest
Jan 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. app.get('/add-users', function (req, res) {
  2. var success = [];
  3. var count = 0;
  4.  
  5. users.forEach(function(user, i){
  6.  
  7. request({
  8. url: url,
  9. method: 'POST',
  10. json: true
  11. }, function(err, resp, body){
  12. if (!err && resp.statusCode === 200) {
  13. success.push('user added');
  14. }
  15. });
  16.  
  17. if(count === users.length) {
  18. res.json(success);
  19. }
  20. });
  21. });
Add Comment
Please, Sign In to add comment