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
Use a global namespace like global.MYAPI = {}:
global.MYAPI = {}
global.MYAPI._ = require('underscore')
All other posters talk about the bad pattern involved. So leaving that discussion aside, the best way to have a variable defined globally (OP's question) is through namespaces.
Tip: Development Using Namespaces