cancel
Showing results for 
Search instead for 
Did you mean: 

MTA App local testing with approuter node js module and ui module

prasad
Participant
0 Kudos

Hi Team,

Created an MTA app using yeoman generator with managed approuter . this created a following structure

in the above approuter nodejs module changed the default start command to

in the userinfo js file was making use of xsuaa service to extract jwt to get email address and also using a destination service to get the destination info in cloud foundry . so over all this nodejs module uses destination and xsuaa service to fetch some custom json .

i can run this locally using VCAP_services and default-env.json file using command

node userinfo by navigating to node js module which gives me the desired json while running locally as below

http://localhost:5000/custominfo

i can also run the ui5 module using below in package.json of mta

"start": "ui5 serve --config=uimodule/ui5.yaml --open index.html",

and npm run start will open the ui5 app in local at port 8080

http://localhost:8080/index.html

My requirement is how would i run both apps at a time locally so that i can fetch the data in approuter node js module and use it in ui module so that i can test locally every thing

as below http://localhost:8080/index.html should run ui5 app and the same port for node js module which gives the custom json and uses destination and xsuaa service

http://localhost:8080/custoinfo --> json data

Wanted to use this custom json data for a default model in ui module using preload true in manifest .json

Regards

Prasad

Accepted Solutions (1)

Accepted Solutions (1)

former_member194549
Contributor

Hi prasad.vsrk,

you can't start both services at the same time on the same port.
Best is to start both services on different ports and use the ui5 tooling proxy to forward the requests from your app to the local UserInfo service.

For documentation on how to configure the proxy, see the appropriate repository.

Regards
Simon

prasad
Participant
0 Kudos

Hi Simon Gaudek,

Thanks for the reply now 2 services are running on different ports and giving desired out put .

installed ui5-middleware-simpleproxy using package.json already in dev dependencies and ui5 dependency

changed the UI5 yaml to include

ui5-middleware-simpleproxy as below

where /myinfo is the path for getting a nodemodule http://localhost:5000/custominfo

but still i face the issue .

is there any thing which needs to be still configured .

Regards

Prasad

former_member194549
Contributor
0 Kudos

Hi prasad.vsrk,

did you try to append the port to the baseUri, i.e. http://localhost:5000.

Regards
Simon

prasad
Participant
0 Kudos

adding the below solved the issue

- name: ui5-middleware-simpleproxy
      mountPath: /myinfo
      afterMiddleware: compression
      configuration:
        baseUri: "http://localhost:5000/myinfo"
        strictSSL: false

Answers (0)