title: How can I make the website automatically run "node index.js" in the browser?
body: <p>I have a javascript web scraping program for stock prices that I want to run automatically on netlify.</p>
  <p>In order for it to run I have to type in &quot;node index.js&quot; in the command terminal.</p>
  <p>But.. how can I make it do so AUTOMATICALLY after uploading it to netlify - without maually typing &quot;node index.js&quot;?
  <a href="https://celadon-smakager-a7fd75.netlify.app/" rel="nofollow noreferrer">Web Scraping/API Practice</a></p>
  <p>It's my first web scraping project - so please be understanding - it's probably a VERRY noobie question.</p>
  <p>Here's the index.js file</p>
  <pre><code>const request = require(&quot;request-promise&quot;);
  const fs = require(&quot;fs&quot;);
  const cheerio = require(&quot;cheerio&quot;);
  
  
  async function tsla() {
      const html = await request.get(
          &quot;https://finance.yahoo.com/quote/TSLA/&quot;
          );
  
      const $ = await cheerio.load(html);
  
      const Price = $('[class=&quot;Fw(b) Fz(36px) Mb(-4px) D(ib)&quot;]').text();
      const Symbol = $('[class=&quot;D(ib) Fz(18px)&quot;]').text();
      const PercentChange = $('fin-streamer[class=&quot;Fw(500) Pstart(8px) Fz(24px)&quot;][data-field=&quot;regularMarketChangePercent&quot;]').find('span').text();
      fs.writeFileSync(&quot;./tslaSymbol.csv&quot;, Symbol);
      fs.writeFileSync(&quot;./tslaPrice.csv&quot;, Price);
      fs.writeFileSync(&quot;./tslaPercentChange.csv&quot;, PercentChange)
      
      console.log(Price);
      console.log(Symbol);
      console.log(PercentChange)
  
      setTimeout(tsla, 1000); //60 seconds == 1minute
  }
  
  tsla();
  
  async function aapl() {
      const html = await request.get(
          &quot;https://finance.yahoo.com/quote/AAPL/&quot;
          );
  
      const $ = await cheerio.load(html);
  
      const Price = $('[class=&quot;Fw(b) Fz(36px) Mb(-4px) D(ib)&quot;]').text();
      const Symbol = $('[class=&quot;D(ib) Fz(18px)&quot;]').text();
      const PercentChange = $('fin-streamer[class=&quot;Fw(500) Pstart(8px) Fz(24px)&quot;][data-field=&quot;regularMarketChangePercent&quot;]').find('span').text();
      fs.writeFileSync(&quot;./aaplSymbol.csv&quot;, Symbol);
      fs.writeFileSync(&quot;./aaplPrice.csv&quot;, Price);
      fs.writeFileSync(&quot;./aaplPercentChange.csv&quot;, PercentChange)
      
      
      console.log(Price);
      console.log(Symbol);
  
      setTimeout(aapl, 1000); // 60,000 = 60 seconds == 1minute
  }
  
  aapl();
  
  
  async function spy() {
      const html = await request.get(
          &quot;https://finance.yahoo.com/quote/spy/&quot;
          );
  
      const $ = await cheerio.load(html);
  
      const Price = $('[class=&quot;Fw(b) Fz(36px) Mb(-4px) D(ib)&quot;]').text();
      const Symbol = $('[class=&quot;D(ib) Fz(18px)&quot;]').text();
      const PercentChange = $('fin-streamer[class=&quot;Fw(500) Pstart(8px) Fz(24px)&quot;][data-field=&quot;regularMarketChangePercent&quot;]').find('span').text();
      fs.writeFileSync(&quot;./spySymbol.csv&quot;, Symbol);
      fs.writeFileSync(&quot;./spyPrice.csv&quot;, Price);
      fs.writeFileSync(&quot;./spyPercentChange.csv&quot;, PercentChange)
      
      console.log(Price);
      console.log(Symbol);
      console.log(PercentChange);
  
      setTimeout(spy, 1000); // 60,000 = 60 seconds == 1minute
  }
  
  spy();
  
  async function nvda() {
      const html = await request.get(
          &quot;https://finance.yahoo.com/quote/nvda/&quot;
          );
  
      const $ = await cheerio.load(html);
  
      const Price = $('[class=&quot;Fw(b) Fz(36px) Mb(-4px) D(ib)&quot;]').text();
      const Symbol = $('[class=&quot;D(ib) Fz(18px)&quot;]').text();
      const PercentChange = $('fin-streamer[class=&quot;Fw(500) Pstart(8px) Fz(24px)&quot;][data-field=&quot;regularMarketChangePercent&quot;]').find('span').text();
      fs.writeFileSync(&quot;./nvdaSymbol.csv&quot;, Symbol);
      fs.writeFileSync(&quot;./nvdaPrice.csv&quot;, Price);
      fs.writeFileSync(&quot;./nvdaPercentChange.csv&quot;, PercentChange)
      
      console.log(Price);
      console.log(Symbol);
      console.log(PercentChange);
  
      setTimeout(nvda, 1000); // 60,000 = 60 seconds == 1minute
  }
  
  nvda();
  </code></pre>
  <p>Basically, the javascript scrapes that data and sends it to a CSV file which then is displayed into the page.</p>