Node-RED: Lecture 6 – Example 6.9 Creating a Blog Site With Node-RED

This final example will show you how to build a micro blog service with only a few nodes in Node RED. You’ll be using the MongoDB node as a storage for posts, http nodes to provide end points for the service and the html node to format the micro-blog web page. Continue reading “Node-RED: Lecture 6 – Example 6.9 Creating a Blog Site With Node-RED”

Node-RED: Lecture 6 – Example 6.8 Letting a function node send multiple messages on a single output

Example 5.2 in Lecture 5 demonstrated how to set up and send messages on multiple output nodes. This example shows how to send multiple message, but on the same output, from a single function node. Continue reading “Node-RED: Lecture 6 – Example 6.8 Letting a function node send multiple messages on a single output”

Node-RED: Lecture 6 – Example 6.7 Multiple inputs on a function node

Function nodes in Node-RED were designed to process messages as single entities. However, in some cases your functions might depend on two separate data sources. There are many ways to handle these cases in Node RED. Continue reading “Node-RED: Lecture 6 – Example 6.7 Multiple inputs on a function node”

Node-RED: Lecture 6 – Example 6.6 Getting earthquake data from an external API

This example demonstrates how to get data from an external API and how to separate that data using a function node. We will use data from an external API that provides access to earthquake data which is made available by the US geological survey (USGS). Continue reading “Node-RED: Lecture 6 – Example 6.6 Getting earthquake data from an external API”

Node-RED: Lecture 6 – Example 6.5 Defining and using an iterator sub-flow

As mentioned in lecture 5, sub-flows can be used to package up functions into nodes in your node palette. In this example, you’ll create a sub-flow that processes an array of values in a message payload and outputs a new processed array[3]. Continue reading “Node-RED: Lecture 6 – Example 6.5 Defining and using an iterator sub-flow”

Node-RED: Lecture 6 – Example 6.4 Using the context element to share a function and make it accessible to all functions in the canvas

This example shows how to use the context object and its global element to share data across function nodes. Continue reading “Node-RED: Lecture 6 – Example 6.4 Using the context element to share a function and make it accessible to all functions in the canvas”

Node-RED: Lecture 6 – Example 6.3 Using context to generate rolling averages

A special module called context, used to store data between function invocations, is available to function nodes. This can be useful when the function needs to retain state to do its processing. For example, in a typical Industrial IoT scenario, Continue reading “Node-RED: Lecture 6 – Example 6.3 Using context to generate rolling averages”

Node-RED: Lecture 6 – Example 6.2 Counting words in a string using a function Node

Next, let’s write a more complex function node that receives some text in a message payload, then outputs multiple messages containing all individual words and the number of times each word was used. Continue reading “Node-RED: Lecture 6 – Example 6.2 Counting words in a string using a function Node”

Node-RED: Lecture 3 – Example 3.7 Using Websockets with Node-RED

Websockets are another useful communication capability that is built into Node-RED via the the websocket node. Websockets provide a duplex TCP connection and were designed to allow web browsers and servers to maintain a ‘backchannel’ that could be used to augment traditional HTTP Continue reading “Node-RED: Lecture 3 – Example 3.7 Using Websockets with Node-RED”