thanks for the help first.
So my problem is: I'm using request in node.js to parse a list o links and I want to get this data in an array then pass to mongoose
function running(link,name,title)
{
try{
request.get(link,function(error,response,body){
return some-data
})
}
catch(error){
console.log(error)
}
};
but if I do this
lstPttn1.forEach(function(data){
//Final link with date pattern
var lnkFnal = data.site + datReq;
lst.push(running(lnkFnal,data.nome,data.titulo)))
});
because request is assynchronous it get a empty list, I'm pretty newbie at assynchronous so I tried to find a solution but didn't find anything like with request, how can I make this happen?
Thanks for the help
via Luiz Fernando Lobo
No comments:
Post a Comment