Loopback connector nodes for Node-RED

[Node-RED] (https://github.com/node-red/node-red) is a porwerful tool to wire together APIs and online services.

It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

You can find Node-Red documentation [here] (https://nodered.org/docs/).

This node module provides a set of custom Node-RED nodes which can be used to integrate Node-RED with any oeCloud.io application.

This integration greatly enhances the existing capabilities of oeCloud.io applications by allowing to observe the application in Node-RED and inject code at runtime without touching the original application.

Prerequisite

  1. Install oeCloud.io. You can find the installation steps [here] (https://www.oecloud.io/getting-started).

Installation

Node-Red and all the added nodes in the node module come out of the box when installing oeCloud.io.

Browse to Node-Red editor

Step 1: Simply add ‘/red’ at the end of the url your application’s server listens to and browse to it

If your application’s server is listenning to: ‘http://localhost:3000’, then your Node-Red editor will be at ‘http://localhost:3000/red’

If you were successful with installation, you will be directed to an unauthorized web page, as you need to be logged in with a user that has admin access rights in order to add\update\delete flows.

The unautorized web page will look something like:

Image

Step 2: Create an admin user in your application

Post the following data to ‘http://localhost:3000/api/BaseUsers’:

{
  "username": "admin",
  "password": "admin123",
  "id": "admin",
  "email": "admin@gmail.com"
}

Post the following data to ‘http://localhost:3000/api/BaseRoles’:

{
  "id": "admin",
  "name": "admin"
}

Post the following data to ‘http://localhost:3000/api/BaseRoleMappings’:

{
  "id": "admin",
  "principalType": "USER",
  "principalId": "admin",
  "roleId": "admin"
}

Step 3: Login with the admin user:

Post the following data to ‘http://localhost:3000/auth/local’ from your browser (for example, if you are using chrome, you can use Restlet Client extention):

{
"username" : "admin",
"password": "admin123"
}

Step 4: Simply add ‘/red’ at the end of the url your application’s server listens to and browse to it

Browse again to the url your application’s server listens to with the addition of ‘/red’.

If your application’s server is listenning to: ‘http://localhost:3000’, then your Node-Red editor will be at ‘http://localhost:3000/red’

You should be able to see a page looking something like this:

Image

Summary

In this guide we learned:

  1. How to browse to Node-Red editor within an oeCloud.io application.

  2. How to login as an admin, in order to be able to create\update\delete flows.