Created
May 25, 2018 18:09
-
-
Save agm1984/9fc48c55ad6a49e4cc440662b8f94e87 to your computer and use it in GitHub Desktop.
Solution example
This file contains 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 axios = require('axios') | |
const followIDs = async (next) => { | |
if (next) { | |
const nextRes = await axios({ | |
method: 'get', | |
url: next, | |
responseType: 'json' | |
}) | |
if (nextRes.data.message) { | |
return nextRes.data.message | |
} | |
return followIDs(nextRes.data.follow.replace('challenge', 'challenge.json')) | |
} | |
const res = await axios({ | |
method: 'get', | |
url: 'https://domain.com/challenge.json', | |
responseType: 'json' | |
}) | |
return followIDs(res.data.follow.replace('challenge', 'challenge.json')) | |
} | |
followIDs() | |
.then(done => console.log('TEST COMPLETE', done)) | |
.catch(err => console.log('TEST ANOMALY', err)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment