Blog, published December 27, 2018 by Justin Hill

New App Development Options with Node.js in Domino 10

Last week’s IBM’s webinar concerning Node.js with Domino 10 was full of interesting information. This webinar went more in depth on how Node.js can be used with a Domino server, adding additional app development capabilities to the platform.

What Node.js for Domino looks like

It comes as a node package (domino-db) which will request access to Domino data from your app and a server task (proton) which listens to these requests.

By adding this package to your node.js app you will be able to create, read, update and delete operations on Domino data. This is done by using the gRPC protocol to talk to the server task, sending messages in the Domino Query Language format.

How do you set up the server task?

Server output showing various server statuses. Notable: "FRONT Listening on 0.0.0.0:9022" highlighted in red.

To use the node package you will need to:

File browser showing the path "/opt/local/domino-db/package" with folders and files like src, domino-db.js, LICENSE highlighted in red.

Terminal screen showing a Node.js installation process with warnings and success messages. Text highlights include "npm WARN," "success," and "found 0 vulnerabilities."

You are now set to go. Here is an example of a simple query:

Screenshot of JavaScript code with comments explaining server setup, database query; adjacent data table lists US states and abbreviations.

And here is the result:

Code snippet showing JSON data with fields for created and modified dates, unid, key as AL, and name as ALABAMA on a black background.

As you might expect there are some query options that you have available:

Using Views

The Domino Query Language can take advantage of Views to improve query performance:

To Create a View:

Using Views

Cataloging a View:

Make sure that if you want to change or add a view, run load updall -a again, If you don’t do it, the views will not be identified.

Node-RED

Node-RED comes to help the ones that are not all into development, but not all out either. It’s basically a visual framework, a node.js app that enables you to create Node.js apps easier.

The access to the standard APIs as Node-RED nodes is encapsulated and provides an easier way to execute those APIs as part of a “flow.”

Here is an example of how you can visually compose your algorithm:

Flowchart with black boxes shows text: "Jedi are totally amazing!" and "sentiment: { score: 4 }". White background with connecting lines.

So, you might ask yourself how does the domino-db looks like with Node-RED nodes. Well, here is a visual answer that might shed some light on the matter:

Flowchart with nodes labeled: DominoDB, Explain My Query, Document Mgr, Get Documents, Replace Docs/Items, Create Documents, Delete Docs/Items.

Each of the above node will implement all the needed code to enable you to connect to a Domino server and to a selected Domino db. You, as a Node-RED “developer” just need to select the right instance of the “dominodb node” on which the node will act upon. Sounds easy enough?

Node-RED has been designed for those of us who know basic programming, just did not go in depth with it. So, if you know how to write some simple JavaScript but not know how to create a NodeJS app, Node-RED is the tool for you.

We hope we made you curious enough to take Node.js and Domino 10 for a spin. You will find out that there were efforts made to improve the face of Domino apps as well as making app development easier and not such a drag.

Let us know how you find app development with Node.js and Domino 10.

Filed under hcl domino, hcl product news