Skip to content

Instantly share code, notes, and snippets.

@tiffboors29
Last active May 12, 2021 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tiffboors29/a93c36f97a6c85b2c72298ebee89edbe to your computer and use it in GitHub Desktop.
Save tiffboors29/a93c36f97a6c85b2c72298ebee89edbe to your computer and use it in GitHub Desktop.
let http = require('http');
(function follow(url){
url = url.indexOf('?') !== -1 ? url.replace(/\?/,'.json?') : url + '.json';
http.get(url, response => {
let rawData = '';
response.on('data', data => {
rawData += data;
});
response.on('end', data => {
let obj = JSON.parse(rawData);
if (obj['follow']){
console.log(obj);
follow(obj['follow']);
}
else {
console.log(obj['message']);
}
})
})
}('http://letsrevolutionizetesting.com/challenge'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment