noober noober - 1 year ago 67
Node.js Question

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


Answer Source

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.