Skip to content

Instantly share code, notes, and snippets.

@topokel
Created December 25, 2013 00:14
Show Gist options
  • Select an option

  • Save topokel/8119034 to your computer and use it in GitHub Desktop.

Select an option

Save topokel/8119034 to your computer and use it in GitHub Desktop.
var a = require('http')
, b = []
, c = {
host: 'api.randomuser.me'
, path: '/'
, port: 80
, method: 'GET'
}
, d = function (e) {
var f = ''
e.on('data', function (g) {
f += g
})
e.on('end', function () {
b.push(JSON.parse(f))
if (b.length === 2) {
console.log(b[0].results[0].user.name.first
+ ' loves '
+ b[1].results[0].user.name.first)
}
})
}
a.request(c,d).end()
a.request(c,d).end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment