NODEJS: How to extract the "real" message with HTTP.get()
This is what I got so far. I do receive a response from http.get().
However, the response called res has many, many attributes and I can't
find where the useful information is...
Everywhere I check, the only thing people mention is res.statusCode, but
that's not really what I'm looking for.
This is the only information I have with the API.
http://services.runescape.com/m=rswiki/en/Grand_Exchange_APIs
This is the JSON I want to have as a variable:
http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=555
Thanks.
var express = require('express');
var http = require('http');
var https = require("https");
var app = express();
var serv = http.createServer(app);
serv.listen(3000);
app.use(express.static(__dirname + '/public'));
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
http.get('http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=555',
function(res) {
console.log(res.statusCode); //200
console.log(res); //BIG OBJECT
//var whatIWant = res.?????
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
No comments:
Post a Comment