Skip to content

Instantly share code, notes, and snippets.

@gor181
Created September 1, 2015 07:53
Show Gist options
  • Save gor181/1496d5d65e11469733f1 to your computer and use it in GitHub Desktop.
Save gor181/1496d5d65e11469733f1 to your computer and use it in GitHub Desktop.
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);
});
});
}
follow('http://letsrevolutionizetesting.com/challenge.json', function (data) {
console.log(data.message);
});
//Congratulations! You've reached the end! You have passed our simple little test and we would love to hear from you. Please save the code you used to a private gist, and fill out the quick application form at https://jobs.lever.co/rainforest. We'll be in touch shortly!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment