app.get is undefined (node.js)
<p>In my <code>app.js</code> file I do the following...</p>

<pre><code>var app = module.exports = express();
</code></pre>

<p>Then in my <code>register.js</code> file I am using <code>get</code> to render a page in the following way...</p>

<pre><code>var module = require('../app');

module.app.get('/register', function (req, res) {
    res.render('register.jade', { title: 'register' });
});
</code></pre>

<p>But I get the error that <code>get cannot be used with app because it is undefined</code></p>

<p>If I change my <code>get</code> function to the following, everything works fine...</p>

<pre><code>exports.register = function (req, res) {
    res.render('register.jade', { title: 'register' });
};
</code></pre>

<p>and change my <code>app.js</code> to...</p>

<pre><code>app.get('/register', reg.register);
</code></pre>

<p>... it will work.</p>

<p>But I want to be able to export <code>app</code> so I can use it in other routes. How do I properly export it?</p>

<p><strong>EDIT</strong></p>

<p>I just realized the proper way to to require the module is using <code>var app = require('./app');</code>.</p>

<p>The path I mentioned before is wrong.</p>

<p>But now I get an error <code>cannot find module ./app</code>, I have no idea why.</p>