Skip to content

Instantly share code, notes, and snippets.

@dionyziz
Created April 23, 2019 14:53
Show Gist options
  • Save dionyziz/2ba2a18115b4ace9d1dee9a8e761efed to your computer and use it in GitHub Desktop.
Save dionyziz/2ba2a18115b4ace9d1dee9a8e761efed to your computer and use it in GitHub Desktop.
axios = require('axios')
function main() {
writeToConsole()
makeHttpRequest()
}
async function writeToConsole() {
while (true) {
console.log('lol')
await sleep(100)
}
}
async function makeHttpRequest() {
console.log('making http request')
await axios.get('https://dionyziz.com')
console.log('made http request')
}
function sleep(interval) {
return new Promise((resolve, reject) => {
setTimeout(resolve, interval)
})
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment