Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
node fetch
node v4.9.1
version:
1.0.0
endpoint
share
tweet
const fetch = require("node-fetch") var getUserDetails = function foo (url) { return fetch(url) .then(function(res) { return res.json() }) }
'await' the promise from the above cell. Destructure the response into variables to build a string
const businessCard = await getUserDetails('https://api.myjson.com/bins/21jy8') const {name, blog, location} = businessCard "Name: " + name + ", Blog: " + blog + ", Location: " + location
Loading…
no comments
sign in
to comment