title: NodeJS exports not defined in external JS file
body: <p>I am calling a function from an external JS file in my routes file. So, I am trying to export a function from my <code>externalFile.js</code> file. However, when I run the node server, it throws <code>Uncaught ReferenceError: exports is not defined</code> . <code>externalFile.js</code> is in <code>public/javascripts/</code> and the route files is in <code>routes/</code>.</p>
  
  <p>External file (<code>externalFile.js</code>):</p>
  
  <pre><code>exports.capsolvingComplete = function (stdout){
      //Received, display text and hide the spinner, put check in place.
      $('#capsolv-complete').css("display", "block")
      $('#capsolv-output').text(stdout);
  }
  </code></pre>
  
  <p>Route file: </p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var script = require('../public/javascripts/externalFile.js')
  
  /* GET home page. */
  router.get('/', function(req, res) {
    res.render('index', { title: 'CapSolv' });
  });
  
  router.post('/file-upload', function(req, res){
      script.capsolvingComplete("HI");
      res.end("success");
  })
  
  module.exports = router;
  </code></pre>
  
  <p>Thank you for your help! Bit of a node noob here.</p>