Skip to content

Instantly share code, notes, and snippets.

@diveddie
Created February 14, 2020 21:37
Show Gist options
  • Save diveddie/c946395a4e2783c384e5d20aa8324757 to your computer and use it in GitHub Desktop.
Save diveddie/c946395a4e2783c384e5d20aa8324757 to your computer and use it in GitHub Desktop.
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