title: How to access the ejs object in express.js
body: <p>I am using express (web framework for node.js) with ejs. Now I'd like to create my own filter as described on the <a href="https://github.com/visionmedia/ejs">ejs github page</a>: </p>
  
  <pre><code>To add a filter simply add a method to the .filters object:
  
  ejs.filters.last = function(obj) {
    return obj[obj.length - 1];
  };
  </code></pre>
  
  <p>The question: <strong>how do I access that ejs object?</strong> I have tried (naively) in app.js:</p>
  
  <pre><code>ejs.filters.myfilter = function (obj) {
    ....
  }
  </code></pre>
  
  <p>which gives me the error:</p>
  
  <pre><code>ReferenceError: ejs is not defined
  </code></pre>