Preface

Node-RED is a flow-based programming tool that was made by Node.js. This tool is mainly used for connecting IoT devices and software applications. However, it can cover not only IoT but also standard web applications.

Node-RED is expanding as a no-code/low-code programming tool. This book covers the basics of how to use it, including new features that have been released from version 1.2, as well as advanced tutorials.

Who this book is for

This book is best for those who are learning about software programming for the first time with no-code/low-code programming tools. Node-RED is a flow-based programming tool, and this tool can build web applications for any software applications easily, such as IoT data handling, standard web applications, web APIs, and so on. So, this book will help web application developers and IoT engineers.

What this book covers

Chapter 1, Introducing Node-RED and Flow-Based Programming, teaches us what Node-RED is. The content also touches on flow-based programming, explaining why Node-RED was developed and what it is used for. Understanding this new tool, Node-RED, is helpful to improve our programming experience.

Chapter 2, Setting Up the Development Environment, covers setting up the development environment by installing Node-RED. Node-RED can be installed for any OS Node.js can run, such as Windows, macOS, Rasberry Pi OS, and so on. We install Node-RED on each environment with the command line or using the installer. This chapter covers important notes for specific OSes.

Chapter 3, Understanding Node-RED Characteristics by Creating Basic Flows, teaches us about the basic usage of Node-RED. In Node-RED, various functions are used with parts called nodes. In Node-RED, we create an application with a concept called a flow, like a workflow. We will create a sample flow by combining basic nodes.

Chapter 4, Learning the Major Nodes, teaches us how to utilize more nodes. We will not only learn about the nodes provided by Node-RED by default but also how to acquire various nodes published on the internet by the community and how to use them.

Chapter 5, Implementing Node-RED Locally, teaches us best practices for leveraging Node-RED in our local environment, our desktop environment. Since Node-RED is a tool based on Node.js, it is good at building server-side applications. However, servers aren't just on beyond the network. It is possible to use it more conveniently by using Node-RED in a virtual runtime on the local environment of an edge device such as Raspberry Pi.

Chapter 6, Implementing Node-RED in the Cloud, teaches us best practices for leveraging Node-RED on a cloud platform. Since Node-RED is a tool based on Node.js, it is good at building server-side applications. It is possible to use it more conveniently by using Node-RED on any cloud platform, so we will make flows with Node-RED on IBM Cloud as one of the use cases with cloud platforms.

Chapter 7, Calling a Web API from Node-RED, teaches us how to utilize the web API from Node-RED. In order to maximize the appeal of web applications, it is essential to link with various web APIs. Its application development architecture is no exception in Node-RED. Understanding the difference between calling a web API from a regular Node.js application and calling it from Node-RED can help us get the most out of Node-RED.

Chapter 8, Using the Project Feature with Git, teaches us how to use source code version control tools in Node-RED. With Node-RED, the project function is available in version 1.x and later. The project function can be linked with each source code version control tool based on Git. By versioning the flows with the repository, our development will be accelerated.

Chapter 9, Creating a ToDo Application with Node-RED, teaches us how to develop standard web applications with Node-RED. The web application here is a simple ToDo application. The architecture of the entire application is very simple and will help us understand how to develop a web application, including the user interface, using Node-RED.

Chapter 10, Handling Sensor Data on the Raspberry Pi, teaches us application development methods for IoT data processing using Node-RED. Node-RED was originally developed to handle IoT data. Therefore, many of the use cases where Node-RED is still used today are IoT data processing. Node-RED passes the data acquired from sensors for each process we want to do and publishes it.

Chapter 11, Visualize Data by Creating a Server-Side Application in the IBM Cloud, teaches us about application development methods for IoT data processing using Node-RED on the cloud platform side. We usually use the data from edge devices on any cloud platform for analyzing, visualization, and so on. Node-RED handles the data subscribed from the MQTT broker and visualizes it for any purpose.

Chapter 12, Developing a Chatbot Application Using Slack and IBM Watson, teaches us how to create a chatbot application. At first glance, Node-RED and chatbots don't seem to be related, but many chatbot applications use Node-RED behind the scenes. The reason is that Node-RED can perform server-side processing on a data-by-data basis like a workflow. Here, we create a chatbot that runs on Slack, which is used worldwide.

Chapter 13, Creating and Publishing Your Own Node on the Node-RED Library, teaches us how to develop nodes ourselves. For many use cases, we can find the node for the processing we need from the Node-RED Library. This is because many nodes are exposed on the internet thanks to the contributions of many developers. Let's aid a large number of other Node-RED users by developing our own node and publishing it to the Node-RED Library.

To get the most out of this book

You will need Node-RED version 1.2 or later, Node.js version 12 or later, npm version 6 or later, and preferably the latest minor version installed on your computer. But this is the case when running Node-RED in a local environment. In the case of running on IBM Cloud, which is one of the tutorials in this book, it depends on the environment of the cloud platform. All code examples have been tested on macOS, Windows, and Raspberry Pi OS, but some chapters have command-line instructions based on macOS.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/-Practical-Node-RED-Programming. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781800201590_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Let's attach a page heading to the body with the <h1> tag."

A block of code is set as follows:

// generate random number

var min = 1 ;

var max = 10 ;

var a = Math.floor( Math.random() * (max + 1 - min) ) + min ;

// set random number to message

msg.payload = a;

// return message

return msg;

Any command-line input or output is written as follows:

$ node --version

v12.18.1

$ npm –version

6.14.5

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "After selecting the name and payment plan, click the Select Region button."

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
44.197.231.211