0

i read this stackoverflow question and this one, and other internet searches. the summery of my search is module.exports and exports point to same object that will be exported and those exports are accessible with require(<package identifier> or <JS file identifire>). because the parameter passing strategy in the JS is call-by-sharing if we assign a function to module.exports the exports object is now useless.(because that exports still pointing to previous value of module.exports) i add this too from nodejs.com, require() function will give us exported variables and functions from main module of a package or a normal js file.

now the question is why in express.js file we have other things that are attached to exports while we assigned a function to module.exports?

kankan256
  • 210
  • 1
  • 4
  • 18

1 Answers1

0

because in this line

exports = module.exports = createApplication;

these are pointing to same function and in js function are objects .

kankan256
  • 210
  • 1
  • 4
  • 18