Tuesday 25 June 2019

Process communication: event listeners vs http requests

I'm using PM2 to scale up my app and I've added some code to handle communication between the processes.I'm using a lot of `process.on` and other event emitter driven actions, but since I need req/res like flow, the code is starting to feel like spaghetti.If I need to share data from one process to another, is there a big reason to go with process communication rather than just exposing http endpoints?I feel like my code would be much more straight forward to have some express routes, and then make req to localhost than to have all these event handlers everywhere. Also seems easier to test...Thanks in advance for any help!

Submitted June 25, 2019 at 09:46PM by urbanNinjuh

No comments:

Post a Comment