LogRocket Blog

Enhance your workflow with Node-RED v4.0

thumbnail

Building a Demo Application Flow with Node-RED

In this tutorial, we will create a Node-RED application flow that:

  1. Notifies users once their specified platform account is logged into
  2. Allows the user to create an order
  3. Displays the orders in a table format

Prerequisites

Before starting, ensure that you have Node.js installed on your machine. We will be using the following nodes:

  • Email node
  • HTTP request node
  • Inject node

Installing Required Nodes

  1. Open Node-RED palette
  2. Go to the hamburger menu > Manage palette
  3. Click on the Install tab and search for required nodes
  4. Install the email, HTTP request, and inject nodes

Setting Up Nodes

  1. Drag the email, HTTP request, and inject nodes to the workspace
  2. Connect the nodes in the following order: Inject → HTTP request → Debug → email
  3. Click the Deploy button to deploy the flow

Working with MongoDB

  1. Set up a MongoDB connection
  2. Use an inject node to trigger flow
  3. Add a function node to handle order logic
  4. Add a MongoDB node to insert order data
  5. Add a debug node to view the output after inserting data

Displaying Orders

  1. Add a MongoDB node to retrieve orders
  2. Connect the node to a template node to display orders in a table format

Deploying Node-RED on Different Platforms

Node-RED can be deployed on various platforms including:

  • Local deployment via npm or Docker
  • Hardware devices (Raspberry Pi, BeagleBone, Arduino, Android)
  • Cloud services (FlowFuse, AWS, Azure, GCP)

Deploying Node-RED on Azure

  1. Create an Azure Virtual Machine
  2. Configure basic info, username, password, etc.
  3. Install Node-RED on the Ubuntu VM
  4. Access Node-RED on your Azure cloud infrastructure

Once deployed, you can design your flows and deploy them instantly to the cloud for enhanced workflow automation.