Node.js global variables

I asked here:
Does Node.js require inheritance?

And I was told that I can set variables to the global scope by leaving out the variable.

This does not work for me.

That is, the following does not make the _ available on required files.

_ = require('underscore');

I can set with Express.js’s app.set and have it available elsewhere though.

Is that how this is supposed to work?

7 Answers
7

Leave a Comment