[Solved] What is happening here in this code? [closed]


The util module has exported an object that contains (probably amongst others) a function under the key inherits:

exports = {
    inherits: function() ...
}

The express module on the other hand, has directly exported a whole function, and that function is immediately invoked and the result assigned to the variable express.

module.exports = exports = function() {
    return ...
}

It is likely that the function has also returned an object containing key/value pairs of functions, just like you’d get from a normal exports object.

See also What is the purpose of Node.js module.exports and how do you use it?

solved What is happening here in this code? [closed]