noober noober - 2 years ago 80
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download