.js,
.json, and then .node.
.js files are interpreted as JavaScript text files, and .json files are parsed as JSON text files. .node files are interpreted as compiled addon modules
'/' is an absolute path to the file. For example,
require('/home/marco/foo.js') will load the file at /home/marco/foo.js.
'./' is relative to the file calling require().
'./' to indicate a file, the module is either a
core module or is loaded from a node_modules folder.
require()
will throw an Error with its code property set to MODULE_NOT_FOUND.
Casiano Rodriguez León 2015-01-07