title: How to test a file using Node.js
body: <p>It's the first time I use Node.js and Express.
  I would create a web scraping. 
  This is my project structure:</p>
  
  <pre><code>WebScrape:
    |_ bin
    |_ node_modules
    |_ public
    |_ routes
    |_ view
    |_ app.js
    |_ package.js
    |_ package-lock.json
  </code></pre>
  
  <p>I've created a <code>scrape.js</code> file inside <code>routes</code> directory:</p>
  
  <pre><code>var express = require('express');
  var fs = require('fs');
  var request = require('request');
  var cheerio = require('cheerio');
  var app = express();
  
  app.get('/scrape', function(req, res) {
  
      // the URL we will scrape from - in our example Anchorman 2
      url = 'http://www.imdb.com/title/tt1229340/';
  
      /**
       * The structure of our request call.
       * The first parameter is our URL.
       * The callback function takes 3 parameters: an error, a response status code and the html.
       */
      request(url, function(error, response, html) {
  
          // check to make sure no errors occurred when making the request
          if(!error) {
              // utilize the cheerio library on the returned html which will essentially give us jQuery functionality
              var $ = cheerio.load(html);
  
              // finally, we'll define the variables we're going to capture
              var title, release, rating;
              var json = { title : "", release : "", rating : ""};
          }
      }) // end request
  }) // end get
  
  app.listen('8081')
  console.log('Magic happens on port 8081');
  
  exports = module.exports = app;
  </code></pre>
  
  <p>How can I test it? Is this the right place to put it?</p>