Communication between Express App and nodered

Hi noderedders,

I have embedded nodered in an express application, as per the instructions here: Embedding into an existing app : Node-RED.

My express application is part of an existing SDK implementation. The SDK receives the HTTP requests using express, parses the payload then passes processing to some custom code. The custom code receives the parsed payload as a javascript object as a parameter. I'd like a nodered flow to replace that custom code, so I'd need some way to pass that parameter to a custom node/function in a node flow, then when done pass control back to the SDK to close the http request.

I had been looking at emitting events from the express side code and have a custom node/function listen for that event, but I am not sure if that is the best way to do this. Is there a best practice for integrating flows with external code?

Thanks.

Events is probably a good way to go and should be pretty efficient.