What does double parentheses mean in a require

This is a pattern in which the module.exports of the module you are requiring is set to a function. Requiring that module returns a function, and the parentheses after the require evaluates the function with an argument.

In your example above, your ./routes/index.js file would look something like the following:

module.exports = function(app) {
  app.get("https://stackoverflow.com/", function(req, res) {

  });
  // ...
};

This pattern is often used to pass variables to modules, as can bee seen above with the app variable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)