Created
October 5, 2018 10:47
-
-
Save CyberRoute/9912366b8ff140d0a1856a6089be1e39 to your computer and use it in GitHub Desktop.
challenge_js
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
var http = require('http'); | |
function follow(url, cb) { | |
http.get(url, function(res) { | |
res.on('data', function (chunk) { | |
var data = JSON.parse(chunk.toString()); | |
if (!data || !data.follow) { | |
cb(data); | |
return; | |
} | |
follow(data.follow.replace('challenge?', 'challenge.json?'), cb); | |
console.log(data.follow); | |
}); | |
}); | |
} | |
follow('http://letsrevolutionizetesting.com/challenge.json', function (data) { | |
if ( typeof data.follow !== 'undefined' && data.follow ){ | |
console.log(data.follow);} | |
console.log(data.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment