Slide 1

Slide 1 text

@knolleary Building Node-RED Nodes for fun or profit NodeConf EU 2022 https://bit.ly/nr-node-workshop

Slide 2

Slide 2 text

@knolleary twitter.com github.com /knolleary twitch.tv ● Nick O’Leary ● Node-RED Project Lead ● Founder & CTO FlowForge Inc. About Me https://bit.ly/nr-node-workshop

Slide 3

Slide 3 text

@knolleary Flow-based programming for event-driven applications The Node-RED editor runs in a browser and allows you to create applications by drawing flows of events. Each node in a flow represents a well-defined piece of functionality, such as updating a value, making a database query or sending a tweet. The developer configures each node as required, focused on what it does, not how it does it. When the flow is deployed to the Node-RED runtime, each node becomes a running piece of code and messages start passing through the flow. https://bit.ly/nr-node-workshop

Slide 4

Slide 4 text

@knolleary A flow is a collection of nodes that are wired together. A node can have a single input port and multiple output ports. Each port can have multiple wires connected to it. https://bit.ly/nr-node-workshop

Slide 5

Slide 5 text

@knolleary The flow is stored as a JSON object – providing the configuration for all of its nodes and how they are connected. The flow JSON can be imported and exported between Node-RED instances, making it easy to share flows. https://bit.ly/nr-node-workshop

Slide 6

Slide 6 text

@knolleary The messages that pass through a flow are JavaScript Objects. By convention they will have a payload property that contains the ‘interesting’ information. This is the property most nodes will operate on by default. https://bit.ly/nr-node-workshop

Slide 7

Slide 7 text

@knolleary Nodes are packaged as npm modules. They contain: - A JavaScript file for runtime behaviour - An HTML file for editor behaviour - A package.json file https://bit.ly/nr-node-workshop

Slide 8

Slide 8 text

@knolleary https://bit.ly/nr-node-workshop Part 1: Getting Started with Node-RED Install Node-RED locally and get your local development environment setup Part 2: Creating your first node Create a very simple node and get it running inside Node-RED Part 3: Adding properties to the node Make your node customisable to change its behaviour Part 4: Writing unit tests for your node Use Node-RED Node Test Helper to create unit tests for your node Part 5: Wrapping an existing npm module Add more functionality to the node using an existing npm module Part 6: Next steps Some suggestions on where to take your node next