Can I "host" stand-alone nodejs apps inside UIBuilder nodes? If so, should I?

OK, I suggest creating a new function in web.js that takes a node instance url and a url root path extension as parameters so that we can reuse it.

So if your uib instance has a url of test, and the url root path is api, the router use path will be <uib-url>/api/.

I also suggest that, for now, we restrict the name of the router file to load to be api.js. You will need to pick it up from the node insances custom folder which you will find in node.customFolder assuming that you call the function from instanceSetup and pass the node parameter through. You have access to fs-extra for file handling. Obviously the api.js file will not exist so that needs to be handled gracefully but you will see examples of that in the web.js file.

Later on, this might be extended with new additions to the Editor panel to allow multiple router files to be loaded to multiple paths. But for now, lets keep it simple because I've still lots of other changes to make before v5 can be published.

The vNext branch should work fine though so testing shouldn't be an issue. I try to keep my GitHub pushes such that the GitHub version is a (mostly) working version. I'll let you know if I have to make any significant changes to web.js.

1 Like