How to run downloaded App Router via Service Marketplace

試著忘記壹切 提交于 2019-12-12 13:38:52

问题


I downloaded XS_JSCRIPT14_10-70001363 package from Service Marketplace. Please suggest me how to run this App Router Login form with localhost I am trying with npm startcommand, but getting UAA service exception. How to handle from localhost.


回答1:


When you download the approuter, either via npm or service marketplace you have to provide two additional files for a basic setup inside the AppRouter directory (besides package.json, xs-app.json, etc.).

The default-services.json holds the variables that tell the approuter where to find the correct authentication server (e.g., XSUAA). You have to provide at least the clientid, clientsecret, and URL of the authorization server as part of this file like this:

{
  "uaa": {
    "url" : "http://my.uaa.server/",
    "clientid" : "client-id",
    "clientsecret" : "client-secret",
    "xsappname" : "my-business-application"
  }
}

You can get this parameters, for example, after binding on SAP Cloud Platform, CloudFoundry your application to an (empty) instance of XSUAA where you can retrieve the values via cf env <appname> from the `VCAP_SERVICES/xsuaa' properties (they have exactly the same property names).

In addition, you require the default-env.json file which holds at least the destination variable to which backend microservice you want to send the received Json Web Token to. It may look like this:

{
  "destinations": [ { 
      "name": "my-destination", "url": "http://localhost:1234", "forwardAuthToken": true 
  }]
}

Afterwards, inside the approuter directory you can simply run npm start which runs the approuter per default under http://localhost:5000. It also writes nice console output you can use to debug the parameters above.




回答2:


EDIT: Turns out I was incorrect, it is apparently possible to run the approuter locally.

First of all, here is the documentation for the approuter: https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/01c5f9ba7d6847aaaf069d153b981b51.html

As far as I understood, you need to provide to files to the approuter for it to run locally, default-services.json and default-env.json (put them in the same directory as your package.json.

The default-services.json has a format like this:

{
    "uaa": {
        "url" : "http://my.uaa.server/",
        "clientid" : "client-id",
        "clientsecret" : "client-secret",
        "xsappname" : "my-business-application"
    }
}

The default-env.json is simply a json file holding the environment variables that the approuter needs to access, like so:

{
    "VCAP_SERVICES": <env>,
    ...
}

Unfortunately, the documentation does not state which variables are required, therefore I cannot provide you with a working example.

Hope this helps you! Should you manage to get this running, I'm sure others would appreciate if you share your knowledge here.



来源:https://stackoverflow.com/questions/53318790/how-to-run-downloaded-app-router-via-service-marketplace

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!