Node Express Middleware
<p>I am currently writing an express app and want to use some custom middleware that I have written however express keeps throwing an issue.</p>
<p>I have an <code>es6</code> class that has a method that accepts the correct parameters like below:</p>
<pre class="lang-js prettyprint-override"><code>foo(req, res, next){
   console.log('here');
}
</code></pre>
<p>then in my app I am telling express to use it like so:</p>
<pre class="lang-js prettyprint-override"><code>const module = require('moduleName');
...
app.use(module.foo);
</code></pre>
<p>but express keeps throwing this error:</p>
<pre><code>app.use() requires middleware functions
</code></pre>
<p>any help would be greatly appreciated.</p>