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:
node-red-node-example |- resources | |- image.png | \- library.js |- example-node.js |- example-node.html \- package.json
A default Node-RED configuration will expose those resource files as:
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