How do I get the node request module to work in electron


#1

I installed the request module into my webscrape project but I can’t get it to work the way it works in nodejs.This file is called in another file with the “var scrape = require (’./scrape.js’)” and call back. It works I tested it. Where it does not work is at the request(URL, function(error, response, html) anything at or after this line does nothing. I don’t understand enough about electron to fix this could someone please give me some directions.

Here is the code for the file.

 function scrape(callback){  
 var content = [];
 var request = require('request');
 var URL = 'http://www.google.com';

 request(URL, function(error, response, html){
   if (error){
       content.push(console.log('Error:', error));
   }
   if (response.statusCode !== 200) {
       content.push(console.log('Invalid Status Code Returned:', response.statusCode));
   }
          
    content.push(html);     
  })
    callback(content);
 }    

 module.exports = scrape;