Created
June 7, 2018 09:13
-
-
Save MaraAlexa/1f8d92e2b8fe7837bbca83733a9cdeb8 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
const fetch = require("node-fetch"); | |
async function showGitHubUser(handle) { // add async keyword | |
const url = `https://api.github.com/users/${handle}`; | |
const response = await fetch(url); // await takes in a promise and pauses the execution until the promise is settled | |
const user = await response.json(); // wait for the json response as well | |
console.log(user.name); | |
console.log(user.location); | |
} | |
showGitHubUser("mariusschulz"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment