Issue with deploying node.js app using apigeetool

While using apigeetool deploynodeapp, although the server.js file name (-m option) and the directory path (-d option) are given, once the node.js api is deployed, all the .js files, node_modules, zip files etc present in the directory path are all imported and can be viewed in the apigee edge UI. Is this the expected behaviour? If yes, why is the -m option mandatory?

When we try to run the API proxy using the trace tool or API console, only the server.js file specified in the -m option gets executed.

Solved Solved
0 4 720
1 ACCEPTED SOLUTION

Thanks Will. However, other .js files were also visible in the scripts and other .zip files, node_modules was also visible. Is this the expected behaviour?

View solution in original post

4 REPLIES 4

Not applicable

Are you saying that only the code in your server.js is working and code outside that file that is called from within server.js is not executing?

Hi Nagashree,

If this helps -- you can read more about apigeetool here. The -m option specifies the "main" Node.js file. The main file is the one you would execute from the command line to run your Node.js application. This file is automatically added to the <ScriptTarget> element in the proxy's target endpoint definition file, making it the target of the API proxy (which is what you see represented in Trace).

Will

Thanks Will. However, other .js files were also visible in the scripts and other .zip files, node_modules was also visible. Is this the expected behaviour?

Hi Nagashree -- Yes, you are seeing the expected behavior. Apigeetool zips and uploads any node modules or code in subdirectories in your project's root. Contents of the zip files are not editable in the UI. However, any standalone .js files in the root folder will not be zipped - you can see and edit them in the Edge UI. I'll update the docs to make this more clear. If your Node app works locally, it is expected to work when deployed to Edge. If that's not the case, please provide more information to help with troubleshooting.