noober noober - 11 months ago 41
Node.js Question

Is 'dot slash' (./) mandatory when a module in Node.js is required?



With require('./script_name'), you can include another JS within the same folder, as you know already.

When you require('module_name') without the ./, Node.JS looks at the node_modules folder for a module with this name. Optionally, you can call it's public methods or pass it arguments.