Last active
February 22, 2017 15:08
-
-
Save mjhea0/2fb9b730b46e01a1e7ab9cf10665903f 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'); | |
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