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

232
Vistas
Nodejs - It is wrong to mix Promise based architecture with events

I'm working on a nodejs app that will become larger. I don't find a lot of ressources for advanced Nodejs project architecture and structure. I would like to know if it's an antipattern to mix paradigm of promises with Events in NodeJS.

If someone have ressources about advanced project architecture or open source large Nodejs projects, it could really help me.

Best regards.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

It is not wrong to mix Promises and callbacks. Sometimes it is necessary, especially if a library or existing code only has one or the other. Callbacks and Promises are just ways of handling the asynchronous nature of NodeJS, so just be aware of controlling the flow of your program.

Some other thoughts:

  • I find it easier to use Promises inside of callback functions, as you can use the Promise resolution to determine when and how to call the callback

  • If possible, promisify your callbacks (or even other callback libraries) if you can! That might be a personal preference of mine since I like promises more. Some libraries even allow you to go from Promises to callbacks, but I haven't done that.

  • The ES6 async/await stuff changes things again! So keep adapting as you are able, or as you need to.

  • There is nothing wrong with callbacks or Promises. No wrong choice and it's ok to mix, just keep control flow in mind.

over 4 years ago · Santiago Trujillo 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