Basically what I am trying to accomplish is to take the results from the handleMusicAPICalls function and push it into the results array, which was declared in the callback function for the get route. Currently when I run this, the fist output is "[]" (from the 2nd console.log) and then under it is the actual data I want to see (first console.log). Any advice?
router.get("/activities", middleware.isLoggedIn, function(req, res) {
var destination = req.query.destination;
var startDate = req.query.daterange.replace(/\s+/g, '').split("to")[0];
var endDate = req.query.daterange.replace(/\s+/g, '').split("to")[1];
var activities = req.query.activities;
var results = [];
helper.handleMusicAPICalls(destination, startDate, endDate, activities, function(res) {
console.log(res);
results.concat(res);
});
console.log(results);
});