Created
February 14, 2020 21:37
-
-
Save diveddie/c946395a4e2783c384e5d20aa8324757 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const follow = function (url) { | |
url = url.indexOf('?')!== -1 ? url.replace(/\?/,'.json?') : url+'.json'; | |
https.get(url, function (res) { | |
let raw = ""; | |
res.on('data', function (data) { | |
raw += data; | |
}); | |
res.on('end', function () { | |
const obj = JSON.parse(raw); | |
console.log(obj); | |
if(obj.follow) { | |
follow(obj.follow); | |
} | |
}); | |
}); | |
}; | |
follow("https://letsrevolutionizetesting.com/challenge"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment