Created
December 5, 2018 15:35
-
-
Save anthonykoch/73c6c0cbb99cb3ef6b1044eec0fa2803 to your computer and use it in GitHub Desktop.
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
'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