Simple application using Node-RED Starter(SDK for Node js, Cloudant NoSQL database) in IBM Bluemix

bluemix1

IBM® Bluemix™ is the Platform as a Service(PaaS) cloud offering from IBM®. It enables organizations and developers to quickly and easily create, deploy, and manage applications on the cloud. Bluemix delivers enterprise-level services that can easily integrate with your cloud applications without you needing to know how to install or configure them. Bluemix provides a dashboard for you to create, view, and manage your applications and services as well as monitor your application’s resource usage. Bluemix dashboard also provides the ability to manage organizations, spaces, and user access.

Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.Node-RED provides a browser-based flow editor that makes it easy to wire together flows using the wide range nodes in the palette. Flows can be then deployed to the runtime in a single-click.JavaScript functions can be created within the editor using the a rich text editor.A built-in library allows you to save useful functions, templates or flows for re-use.

In IBM® Bluemix™, a boilerplate is a container for an application and its associated runtime environment and predefined services for a particular domain. You can use a boilerplate to quickly get up and running. The Node-RED Starter boilerplate has Node-RED,Cloudant databse and Monitoring and Analytics Services as a combo pack.You don’t have to spend time in adding or binding services.

The steps below will help you to build a simple twitter feed application and insert those tweets into Cloudant database with the Node-RED Starter boilerplate.

Prerequisites

Step 1: Choose the Boilerplate Node-RED Starter from the CATALOG tab1.2

Step 2: Input the host name and click on CREATE

1.1

Step 3: Hurray! The application is created with Cloudant NoSQL DB and SDK for Node js

blog2

Step 4: One instance of the application is running perfectly! Click on the URL

blog3Step 5: Click on the button Go to your Node-RED flow editor


3

Step 6: The Node-RED page opens up with the nodes for each functionality on the left side


4.1

Step 7: Drag and drop the twitter node to the sheet1 (ensure you drag and drop the correct node)

twitter

Step 8: Double click on the twitter node and enter the required fields(ensure that you authenticate it with your twitter id) and click Oktwitter3Step 9: Drag and drop debug node in sheet 1


debug

Step 10: Enter the required field as shown below

debug2

Step 11: Drag and drop cloudant node to sheet1(ensure that you have choosen the correct node)

cloudant

Step 12: Double click the node and enter the required details

cloudant2

Step 13: Wire the nodes from its node points and click on DEPLOY

out

Step 14:Yes,now you can see live tweets for the hastag #bluemix on your debug console!!

output

Step 15: Goto the cloudant database

cloudb

Step 16: Click on Launch

cloud1

Step 17: You can see the database (tweets) ! Click on it. 

cloud2

Step 18: You can see the documents with unique id and _rev

we

Step 19: Click on one of the document and you can see the tweet,date,time,created by whom and all other details in JSON format.

out2

You can use the documents inserted in the Cloudant NoSQL database for further use and Yes,the application was ready within few minutes! That’s the power of Node-RED in IBM Bluemix. You can drag and drop other several nodes which are available in Node-RED to make this a better application(for analysis,for sending notifications etc)

Thanks to Node-Red,Cloudant NoSQL database and IBM Bluemix! You just saved our time from writing 1000 lines of code!

Courtesy: IBM Bluemix, Node-RED, Cloudant NoSQL Database

Advertisements