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

144
Vistas
How to transfer information between controllers with Node/Express

I have two controllers, A and B. The controller A has, among other functions, the ability to GET the information from a Module. Let's call this function getA.

I export the controller with:

module.exports = controllerA

And I try to use the information in the controller B first by importing controller A:

const a = require('controllerA')

However, when I try to get the information returned by "getA", it's either undefined or "anonymous".

How could I retrieve this information?

Further information

When I try to print by console the const a, I get the following error:

type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type function ([AsyncFunction (anonymous...)

And when I try to do a console.log(a._id) it returns undefined

I'm not sure if this matters, but controllerA depends on the user token to retrieve the information (authorization headers, bearer token...)

about 4 years ago · Juan Pablo Isaza
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