In earlier versions of Node-RED, the node would have to create custom HTTP Admin end-points to serve up those resources.
With Node-RED 1.3 or later, if a module has a directory called
resources at the
top level, the runtime will make anything in that directory available to the editor
under the url
For example, given the following module structure:
| |- image.png
| \- library.js
A default Node-RED configuration will expose those resource files as:
Note: If using scoped module names then the scope needs to be included in the path:
When loading resources in the editor, the node must use relative URLs rather than absolute URLs. This allows the browser to resolve the URL relative to the editor URL and removes the need for the node to know anything about how its root paths are configured.
Using the above example, the following HTML can be used to load those resources in the editor:
<img src="resources/node-red-node-example/image.png" />
Note the URLs do not start with a