Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
why both exports and module.exports used in main module of express (express.js file)

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?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

because in this line

exports = module.exports = createApplication;

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda