Node.js in Apigee.

On which engine node.js runs in Apigee Edge?

What is the way to connect the node.js backend in the Apigee?

And how to use npm modules in Apigee Edge?

0 3 315
3 REPLIES 3

Node.JS (ScriptTargets) runs on the JVM in Apigee Edge.

Till a few years ago, the engine used to be called Trireme - https://github.com/apigee/trireme and the interpreter used to be called Rhino (This is the JVM interpreter)

I am not sure if that has been switched out/updated. (EDITOR's NOTE: This is still true.)

Connecting to a Node.JS backend and a Node.JS Target are two different things. In the latter implementation, your application runs within Apigee and you connect to it using a ScriptTarget

Basically, in your target connection you would do something like

 <ScriptTarget>         
  <ResourceURL>node://server.js</ResourceURL>    
 </ScriptTarget>

In this case, the NodeJS application runs within Apigee Edge and the lifecycle of the application is managed by Apigee Edge.

Another implementation of Node.JS could be where a Node.JS backend lives outside Apigee..but in this case you access it over HTTP and it is no different than any other target API

To use Node Modules with Node.JS Apps, you either install them and run the npm install command while deploying your application OR you can pre-package them while pushing your node application using Management API.

Please refer apigeetool https://github.com/apigee/apigeetool-node#deploynodeapp and notice the difference between the "resolve-modules" and "upload-modules" option.

You might also want to checkout the newer option of Hosted Targets https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-overview

Thanks @akhimich