Skip to content

Instantly share code, notes, and snippets.

@anthonykoch
Created December 5, 2018 15:35
Show Gist options
  • Save anthonykoch/73c6c0cbb99cb3ef6b1044eec0fa2803 to your computer and use it in GitHub Desktop.
Save anthonykoch/73c6c0cbb99cb3ef6b1044eec0fa2803 to your computer and use it in GitHub Desktop.
'use strict'
const axios = require('axios')
const url = require('url')
const delay = (time) => new Promise((resolve) => setTimeout(resolve, time))
!async function main() {
const baseUrl = 'https://letsrevolutionizetesting.com/challenge.json'
let req = await axios.get(baseUrl)
while (req.data.follow) {
const followUrl = new url.URL(req.data.follow)
const nextUrl = baseUrl + followUrl.search
req = await axios.get(nextUrl)
console.log(req.data)
await delay(1000)
}
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment