Hi, I'm new to Node Red an Node.js but I have got a couple of my own Nodes working now so understand the basics.
I have hit a challenge around showing a list of devices in the Node's Properties tab so that one can be selected for that Node. The code to do that is a separate module that is currently included into the server side code so how do I access it from the client side config code so that I can show the list?
I have looked at some examples and they are recreating some of the service access code using $.get or whatever, rather than the separate module. I don't like this very much - it's brittle and not DRY.
Ideally I would expose the separate module to the client side code through the Config Node but I'm not sure how to achieve this.
I am also confused that server side you use RED.nodes.getNode()
to get a node, but this isn't available client side and you use RED.nodes.node()
instead.
I guess the way to do this is for the client side/config code to include in my separate module and for me to instantiate it and pass the config token to it?
But for some reason myConfigNode.credentials.token
doesn't appear to be set after getting myConfigNode
using RED.nodes.node(node.configNode)
.
Some pointers on the best practise for this would be much appreciated, preferably with a link to a good example!
Thanks