While using express 4.x, I am setting the port in my server.js like in the following.

```
var express = require('express');
var app = express();
...
var port = process.env.PORT || 8080;
app.set('port', port);
...
module.exports = app;

```

But when I try to access it within my routes file, like the following...

```
// path to routes file is app/models, hence the '../../'
var app = require('../../server');

// default route
router.get('/', function (req, res) {
    res.send('Hello! The API is at http://localhost:' + app.get('port') + '/api');
});

```

... I get the following error.

```
TypeError: app.get is not a function

```

What on earth is going on?