How to use a core node inside of a custom node implementation

Sorry to disappoint, that's not how CORS works. It's not a header you set in the request, but a header that the server you're requesting has to set in their response...

I will cite myself

You put the top code in the javascript file of your node. This will create an http endpoint in that node. So it has nothing to do with the http node. Look at the various examples we have posted where to put that code.
Since the editor html is served from the same origin as the runtime, you will not have a CORS issue.

@afelix Makes sense. Looks like I will spend some time to read about CORS when i finished my custom-node :smile:

@cinhcet I now got you :+1: . There are a lot of new node-red terms I have to get familiar with. Now I understand what you mean with endpoint solution. And now I also don't need the config node on the client side any more because the device list is retrieved at the server side.

@JGKK & @cinhcet - You made my day. Now the list of devices is presented in a drop down list.

Thank you very much for your help and your pushes to get me in the right direction with my first custom-node. With your help I enjoyed to have a steep ramp up on node-red, js, node, client/server communication, CORS, ... Actually all is used in @JGKK s code but I frankly didn't notice it's a dedicated endpoint which is used in in the client code. i was still on the server side - unfortunately.

There is still the error handling and notification missing but nevertheless I would consider the code now beta :wink:

Two final node-red questions:

  1. Should every device name used in a switch node as soon as it was created be disabled and no creation of switch with the same device is possible? That way every switch becomes a singleton.
  2. Right now it's possible to change the device name at any time. Doesn't it make sense to disable a device name change? This is somehow related to my first question.