Skip to content

Commit

Permalink
updated servi http get example
Browse files Browse the repository at this point in the history
  • Loading branch information
robynitp committed Mar 12, 2015
1 parent 35f2b10 commit 3406f77
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions week6/13-servi_get_api/servi_http_get.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ http.get(url, function(res) {
data += chunk;
});
res.on("end", function() {
console.log(data); // <-- this is the JSON
// do stuff with the JSON data here
console.log(data); // <-- this is a JSON string
data = JSON.parse(data); // convert string to JSON object
console.log(data.coord); // do stuff with the JSON data here
});
}).on("error", function(e) {
console.log("Got error: " + e.message);
Expand Down

0 comments on commit 3406f77

Please sign in to comment.