Editor
Node-RED provides a flow editor accessed as a web application using a web browser. Using the editor, you can create your flow by dragging pre-defined nodes from your palette into a workspace and connecting them together to define a sequence of actions triggered by events. The flow is deployed to the server and can receive the programmed inputs and take the programmed actions to generate the programmed output.
The editor has three main panels:
- The Nodes Palette
This panel contains a list of nodes that you can use to create a flow. Nodes are grouped by categories: "input", "output", "function", "social", "storage" and others. Node-RED comes with a few pre-installed sets of nodes. There are several additional nodes available, which can be added to the palette using the Manage Palette menu option.
- The Flow Panel
This panel is where you create Node-RED "flow" by placing nodes from the Nodes panel (drag and drop them) and connecting them together.
- The Info and Debug Panel
This panel contains two commonly used tabs, Info and Debug.
The info tab provides information about a node. This information can help you understand how the node functions and provides information about its type, properties, usage, and required configuration.
The debug tab provides information printed with the debug node if one is used in your flow. When creating a flow, before sending data to a circuit for some action or to a message broker or database for forwarding or storing, you can use the Debug node to review the output data in the debug tab. There is a Configuration Nodes tab that groups all nodes that need some configuration information to be specified. While this can also be done by clicking on each configurable node, the grouping makes it convenient. The Help tab, as the name suggests, it provides instructions on using nodes. Node-RED provides a way to store information that can be shared between different nodes without using the messages that pass through a flow. It is called context, and the Context Tab allows you to track this data
Deploying Flows
After creating the flow, it must be deployed to the Node-RED server. The editor has a "Deploy" button located on the right side of the top menu bar. Whenever you make a change to your flow, you must re-deploy your changes by clicking on the Deploy button again.
The deploy link gives you options to deploy incremental changes only or to deploy the entire flow. You can also restart the flow. Once deployed, the flow keeps running as long as the server is running.
Exporting Flows
Flows can be exported in JSON format and saved as a plain text file. After that, flows can be imported into another Node-RED server deployment.
This is an example of a low-code program written in the Node-RED editor.