I realise there are similar questions on SO but I can't find one that helps me. I have an Expressjs 4 app and I'm using SocketIO too. A snippet of my `server.js` file looks like this:

```
// server.js
...
var app = express();
var server = require('http').createServer(app).listen(process.env.PORT || 8080);
var io = require('socket.io')(server);

var routesApi = require('./server/routes/api');

module.exports = app;

```

and I have `api.js`:

```
// server/routes/api.js
...
var ctrlPosts = require('../controllers/posts');
router.post('/posts', ctrlPosts.create);
...

```

and my posts controller:

```
// controllers/posts
module.exports.create = function(req, res) {
  //how can I access io from here?
}

```

**Question**
How can I access SocketIO from my posts controller?