Wednesday, 24 May 2017

calling async function recursively in node.js

I am new to node.js.Learning async library,currently I have array of urls.For each url,I have to make a request to some website and from that website I will get its hyperlinks from html page.So we I have to make a call recursively with request.js module of Node.js.

urls=["a.com","b.com"];
getUrls(url,cb){

    request(url,function(error,response,body){

        if(response && response.statusCode==200)
        {


        }

        cb();
    });
}

startProcess(urls){

    async.map(urls,getUrls,function(error,data){

    })

}

I am not getting ..how to proceed from this point ?

Can it be done without async.map function ?



via Udit Kumawat

No comments:

Post a Comment