Last active
December 16, 2015 05:19
-
-
Save hminaya/5383073 to your computer and use it in GitHub Desktop.
get JSON api with node (server side javascript)
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
var http = require('http'); | |
var url = 'http://www.emplea.do/jobs.json'; | |
http.get(url, function(res) { | |
var body = ''; | |
res.on('data', function(chunk) { | |
body += chunk; | |
}); | |
res.on('end', function() { | |
var result = JSON.parse(body) | |
console.log(result); | |
}); | |
}).on('error', function(e) { | |
console.log("Error: " + e.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ya que en los ejemplos de Ruby y Python se usan librerias externas, supongo que lo justo sería esto: