Skip to content

Instantly share code, notes, and snippets.

@tiomoreno
Created June 20, 2014 01:58
Show Gist options
  • Save tiomoreno/817b36a5b4ef0e0b4fc5 to your computer and use it in GitHub Desktop.
Save tiomoreno/817b36a5b4ef0e0b4fc5 to your computer and use it in GitHub Desktop.
Um hack simples para pegar uma parcial com os jogos da copa em Node.js
var http = require('http');
http.get("http://worldcup.sfg.io/matches", function(response) {
var body = '';
response.on('data', function(chunk) {
body += chunk;
});
response.on('end', function() {
var matches = JSON.parse(body);
matches.forEach(function (jogo) {
if (jogo.status === 'completed') {
console.log(jogo.home_team.country, jogo.home_team.goals, 'x',
jogo.away_team.country, jogo.away_team.goals);
}
});
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment