Skip to content

Instantly share code, notes, and snippets.

@agm1984
Created May 25, 2018 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agm1984/9fc48c55ad6a49e4cc440662b8f94e87 to your computer and use it in GitHub Desktop.
Save agm1984/9fc48c55ad6a49e4cc440662b8f94e87 to your computer and use it in GitHub Desktop.
Solution example
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