Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

143
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda