I am using a node.js app as a hosted target in Apigee. The node app requires 2 command line arguments to be passed, which is done by the prompt module in the node app. When I use the app as a hosted target can I pass those arguments at runtime?(I know there is a way to pass it using the app.yaml file but I dont exactly know how). Also can I access these arguments in a JavaScript policy at runtime? I am working on Hosted Target for the first time so any leads on this topic would be very helpful. Thank you!
The node app requires 2 command line arguments to be passed, which is done by the prompt module in the node app. When I use the app as a hosted target can I pass those arguments at runtime?
I think maybe you might have to redesign the node app just a bit.
The prompt module, as I understand it, can be used by an interactive nodejs to prompt the user for some input.
There is no way to prompt the user for input in a Hosted Target. The HT node app is headless and serverless. You don’t get to interact with the terminal that is running the HT node app. So I think prompt is probably the wrong module.
I know there is a way to pass it using the app.yaml file but I dont exactly know how
can I access these arguments in a JavaScript policy at runtime?
No. And this question suggests you have a basic misunderstanding. You’re passing arguments to the nodejs app. That app is remote. The JavaScript policy runs in the gateway; it’s local. The JS policy doesn’t have access to the remote nodejs app, nor to the environment variables or “parameters” you’ve passed to the remote nodejs app.
I am working on Hosted Target for the first time so any leads on this topic would be very helpful.