NodeJs Require a File
<p>I am using NodeJS. Is it possible to require a javascript file in node as we do in browsers? Because when I use the require() method it calls a javascript file that as no access to the global variables in my server.js it is like a "use strict" I guess. I needed to load my module and make it a continuation of the main file since my module depends on some global variables.</p>

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

<p>I have this server.js file:</p>

<pre><code>var Settings = require("settings.js");
var Clients = require("clients.js");
var removePack = [];

/**HERE RUNS MY WEBSOCKET SERVER**/
...
...
//When a new socket connects:
io.on("connection", function(socket){
    var socket.id = Math.random();
    var client = Clients.create(socket.id);
});
</code></pre>

<p>Here my clients.js file:</p>

<pre><code>exports.create = function(){
    self.team = Settings.generateRandomTeam(); /*The problem is here. I can´t access the Settings variable*/
    self.maxSpeed = Settings.maxSpeed;
    ...
    ...
    return self;
}
</code></pre>

<p><strong>EDIT 2:</strong></p>

<p>When I use Settings = require("settings.js") I get the following error:</p>

<p>TypeError: Settings.generateRandomTeam() is not a function.</p>

<p>My settings.js file is like this:</p>

<pre><code>Settings.generateRandomTeam = function(){
   //Some code
}

module.exports = Settings;
</code></pre>

<p>Thanks!</p>