-
-
Save KevinTCoughlin/b62ec33c9cfc896db0806219cafa78e8 to your computer and use it in GitHub Desktop.
NodeJS with Async/Await
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
var fetch = require('node-fetch') | |
async function getDataFromAPI() { | |
let response = await fetch("https://api.github.com/users/up1") | |
let data = await response.json() | |
console.log(JSON.stringify(data, null, "\t")) | |
} | |
getDataFromAPI() |
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
var fetch = require('node-fetch') | |
function getDataFromAPI() { | |
return fetch("https://api.github.com/users/up1") | |
.then(response => response.json()) | |
.then(data => console.log(JSON.stringify(data, null, "\t"))) | |
} | |
getDataFromAPI() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment