api endpoint: https://api.guildwars2.com/v2/achievements/daily
I am new to api interfacing and web apps in general
According to Node's API docs, HTTPS.get returns a ClientRequest object.
My code is the following:
var dailiesURL = 'https://api.guildwars2.com/v2/achievements/daily';
var dailies = https.get(dailiesURL, parseResponse);
function parseResponse(response) {
var body = '';
response.on('data', function(chunk) {
body += chunk;
});
response.on('end', function() {
dailyResponse = JSON.parse(body);
console.log(dailyResponse);
});
response.on('error', function(e) {
console.log("Got an error: ", e);
});
}
console.log(dailies);
The documentation says that the callback function in https.get should make sure to store off the json data as get returns a ClientRequest object. I'm struggling to figure out exactly how one saves off the parsed json.
Should I be using something other than https.get/request?