Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

What do "module.exports" and "exports.methods" mean in NodeJS / Express

// foo.js
var exports = {}; // creates a new local variable called exports, and conflicts with

// living on module.exports
exports = {}; // does the same as above
module.exports = {}; // just works because its the "correct" exports

// bar.js
exports.foo = 42; // this does not create a new exports variable so it just works
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #What #NodeJS #Express
ADD COMMENT
Topic
Name
4+8 =