Integrating NodeJs with Gateway server
To start Nodejs inside a gateway server, perform the following actions.
- Open the gateway server profile in eStudio.
Go to Fiorano > Esb > NodeJs > NodeJs and enable the EnableStart property.
Ensure that the Gateway server is not running.
By default, a script file which starts a webserver is configured for 'ScriptFilePath' at $FioranoHomeInstaller\esb\samples\nodejs\httpserver. The path can be changed by editing the ScriptFilePath property and the script file can be customized if required by accessing the file from the saved location.
Figure 1: Enabling EnableStart property- Press CTRL+S or click the Save icon to save the profile.
Go to Installer\extlib\j2v8 and retain only the jar related to the corresponding OS after deleting other OS-related jars.
Stop the AMS server if it is running in the same system where AGS is running.
- Create a folder named "jni" at Installer\esb\server\bin folder.
- Extract the j2v8 jar and copy the following file to the jni folder.
- Windows: .dll
- Linux: .so
- mac: .dylib
- Delete the extracted folder.
Start the peer server and check the following statement in the peer console which acknowledges that the Nodejs server is started inside the peer server:
CODEStarted NodeJs Http server on port 8000
Figure 2: Acknowledgement message appearing on the gateway server consoleTo check if the connection is established, invoke the following URL in the browser, which ideally gives "Hello World" as the response:
CODEhttp://localhost:8000/
Figure 3: Testing the connection