Node.js - Passing variables dilemma

I have my main (main as in package.json) set to app.js, it starts a web server.

I need to return the server variable to other files. I added: module.exports = server;

But it returns an empty table. As far as I know, module.exports is only ran on required, so app.js won't be run on any require, as it will have been ran by the node command.

What am I missing here?