What does require(‘../’) mean? [duplicate]

A folder can be used as a module if the folder contains any of the following files (in lookup order): package.json, index.js, or index.node.

In this case, the folder has a package.json file that, among some other things, states that the main file of the module is the index.js file in the same directory. So the require('../') call you asked about could be changed to require('../index.js').

See Node.js Documentation – Folders as Modules for more information.

Leave a Comment