Created
March 10, 2017 09:41
-
-
Save dupski/09c501224bc9a2060075a7b4d09b9eb6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import * as request from 'request'; | |
request({ url: 'https://randomuser.me/api/', json: true }, | |
function(error, response, data) { | |
if (error) { | |
console.error(error); | |
} | |
else { | |
let user = data.results[0]; | |
request({ url: 'http://quotes.rest/qod.json', json: true }, | |
function(error, response, quoteData) { | |
if (error) { | |
console.error(error); | |
} | |
else { | |
let quote = quoteData.contents.quotes[0] | |
console.log(user.name.first + ' says: ' + quote.quote); | |
} | |
} | |
); | |
} | |
} | |
); | |
console.log('Got Here.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment