Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidystephenson/ff451d67a8b6d66fabf2fb306f516c6b to your computer and use it in GitHub Desktop.
Save davidystephenson/ff451d67a8b6d66fabf2fb306f516c6b to your computer and use it in GitHub Desktop.
<script>
console.log('before')
async function main () {
const uploadData = { message: 'ready' }
const uploadJson = JSON.stringify(uploadData)
const init = { body: uploadJson, method: 'POST' }
// { body: JSON.stringify(uploadData), method: 'POST' }
const dogResponse = await fetch('https://dog.ceo/api/breeds/image/random', init)
}
main() // asynchronous / non-blocking
console.log('after')
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment