title: pass module parameters from controller to model in NodeJs
body: <p>I use the MVC pattern for my NodeJs application.</p>
  
  <p>I have a module called <code>logger</code>, it's a customized <code>console.log</code> function and I want to access this module in all other modules because I want to log information everywhere.</p>
  
  <p>So my <code>server.js</code> requires the logger module. Then it passes this parameter to the controller.</p>
  
  <pre><code>const model = require('./model');
  
  module.exports = function(app, logger){
  
  app.get('/', function (req, res) {
      res.render('main', model.funcOne());
  });
  
  };
  </code></pre>
  
  <p>So I want my model having this logger variable.</p>
  
  <pre><code>module.exports = {
    funcOne: function(){
      logger.log("msg"); // missing module
      return {
  //
      };
    },
  
    funcTwo: function(){
      logger.log("msg"); // missing module
      return {
  //
      };
    }
  };
  </code></pre>
  
  <p>Some possibilities:</p>
  
  <ul>
  <li>I always set the logger variable as a parameter of my model functions</li>
  <li>I require this logger module in each module</li>
  </ul>
  
  <p>Are there any better / cleaner ways?</p>