Hey folks, I've just stumbled onto Node Red about a week ago and am having a lot of fun, thanks to IBM for the wonderful tool.
I'm looking to create a couple of custom nodes and this topic seems to have progressed quite a bit over the course of the beta versions and now to 1.0 with an automatic generator out in the wild. Sadly there are not a lot of step by step examples of custom nodes out there, and it seems that there's more than one way to go about this.
I've tested the nodegen application on a working rather complex function and it worked like a champ. So for the purpose of rapid development, does it make sense to use the nodegen app on an existing function and then just modify the nodegen output to add property choices? It seems to me from looking at the nodegen output that nodegen is just string-quoting my original function back to me, so to speak, to process its original logic with extra boilerplate stuff around it.
If that's the case, what's to stop me from simply modifying the HTML file to add the fields and variables I want, and then going into my original function string in the nodegen output and adding
__node__.variable entries for each variable I defined in the HTML settings? Along with some
if (!variable) defaults in that original function code for sane defaults if a bad setting gets past the HTML form validation?
It seems like the above would be the most pain-free way to rapidly turn functions into dynamic nodes.