Configuring node.js and using it with Domino: here are the first steps and how to do it from scratch.
(This article is the first of a series, we will update the links as we proceed to publish everything)
With the release of the latest version of Domino and the AppDevPack for both Linux and Windows, it is now possible to start working on the integration between node.js and Domino.
So we started to do this and here we publish the steps taken and some suggestions on how to proceed.
The following documentation refers to the installation on a Windows server and, for simplicity, we assume that node.js is installed on the same machine where Domino is installed.
All the version numbers are referred to April 2019 , when this doc has been published.
We also assume that you’ve already downloaded the AppDevPack 1.0.1 that includes the files for Windows.
What is Node.js
Why use Domino with node.js?
node.js is an environment but it does not have a database. With the integration of Domino and the Domino Query Language technology (of which we had already wrote here) it becomes possible to use Domino as a no-sql database and then access the pre-existing data or create new dbs to be used with node.js.
The AppDevPack contains the 2 principal components used to make a connections between Node.js and Domino:
- Proton, the Domino task that listens to Node.js calls and manages the responses
- Domino.db 1.2.0, the npm module to install on Node.js to have the support for the calls to Domino in Node.js
1. Installation of Node.js on Windows
Go to the official Node.js site and download the version you need
Launch the install and you will be asked if you want to install only Node.js or also the other associated components. We suggest to leave all the checkboxes selected and continue. Overall is important to select the npm package manager that you will need later: npm is the node.js package manager that you will need to download and install a series of packages (modules) that extend the functionalities of node.js.
We can verify the success of the installation by typing the commands:
node --version npm --version
which will return, in case of success, the versions of the two newly installed software.
The other component needed is PROTON, the Domino task that accepts the calls from Node.js
You can find it inside the AppDevPack, unpack it and locate the proton.exe file that you need to copy in the Domino programs folder (we are assuming, of course, a Windows installation)
Note : the communication between Node.js and Proton can happen in two ways, anonymous and not crypted or with username and certificates. Now we begin with the anonymous communication, later we will describe the authenticated communication.
Now modify the notes.ini of the Domino server adding these 3 lines:
PROTON_SSL=0 PROTON_LISTEN_PORT=3002 PROTON_LISTEN_ADDRESS=127.0.0.1
As said before ,the first line is needed to configure the method of communication (SSL or not). Setting this to 0 we choose not to use SSL.
The second line is needed to select the TCP/IP port used by Node.js to communicate with Proton, 3002 is the default value.
The third line allows us to filter the address from where the requests will arrive. In our case we have Node.js on the same server as Domino so we set it as localhost.
Now you can start proton using the command “load proton” on the Domino console and/or adding it to the servertasks in the notes.ini.
For more information about Proton see this link https://doc.cwpcollaboration.com/appdevpack/docs/en/proton-admin.html
If you want to check what the Proton task is doing, you can use the ‘sh stat proton’ command from the Domino server console:
End of part 1, stay tuned for the next articles!