Skip to content

Instantly share code, notes, and snippets.

@mjhea0
Last active February 22, 2017 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjhea0/2fb9b730b46e01a1e7ab9cf10665903f to your computer and use it in GitHub Desktop.
Save mjhea0/2fb9b730b46e01a1e7ab9cf10665903f to your computer and use it in GitHub Desktop.
const fetch = require('node-fetch');
const url = 'http://www.omdbapi.com/?t=star+wars&y=&plot=short&r=json';
async function getData() {
let content
try {
const response = await fetch(url);
content = await response.json();
} catch (e) {
console.log(e);
}
return content;
}
getData()
.then((res) => { console.log(res); })
.catch((err) => { console.log(err); })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment