Hi There,
I have a question related to the RED object that exists in three different incarnations:
- RED in the backend
- RED in the context of a function node
- RED in the frontend browser console
each of these RED objects has a different API, eg: RED.nodes.node(<nodeid>)
will return the node object in the frontend, RED.nodes.getNode(<nodeid>)
will do the same thing in the backend and in a function node this isn't possible:
msg.node = RED.nodes.getNode("nodeid")
results in
"TypeError: Cannot read properties of undefined (reading 'getNode')"
when done in a function node.
What this means is that in a custom node, I can use the RED.nodes.getNode(<nodeid>)
to get a node, in the function node I can't but how do I know?
So here my question: is there a way to start the Node-RED backend in a console mode where I can start the backend in the context of a flows.json and then start play around. Something like:
shell-prompt> node-red --debug-console
Welcome to Node.js v21.6.1.
Type ".help" for more information.
Node-RED v3.1.1 loaded
/user/fubar/.node-red/flows.json loaded
> console.log(RED)
....
This would make testing custom nodes a little simpler.
Sorry if this has already been answered ...