running same UI5 app locally and in WebIDE, with real and mockdata

Viewed 611

What I am trying to achieve: common codebase that can run unmodified on both local installation and in the WebIDE, both with real backend and mockdata. Mostly because I really prefer VSC as editor. The app itself is a plain list of materials and descriptions, single view, nothing fancy.

Where I am at:

  • local: setup works fine, both mockdata and real backend, using cors-anywhere as proxy.
  • WebIDE: works only when started as "SAP Fiori Launchpad" pointing directly to Component.js to access the real backend; no luck running it with "Web Application" using index.html or test/mockServer.html (they don't boot, sap-ui-core is not found) and no mockdata (see below).

Digging around, I found that:

  • as far as WebIDE is concerned, I didn't have to explicitly clone index.html to test/mockServer.html and I could just configure it to provide mockdata with a config option although this doesn't work in my case: enter image description here

  • my mockserver rootUri is not relative, because I had to match the proxy url in manifest.json

      "dataSources": {
        "ProductRemote": {
          "uri": "http://localhost:8081/http://10.0.98.194:8017/sap/opu/odata/sap/ZDEMO_FIORI_ABO_SRV/",
          "type": "OData",
          "settings": {
            "odataVersion": "2.0"
          }
        }
      }
    

to that in uimodule/webapp/localService/mockserver.js:

rootUri: "http://localhost:8081/http://10.0.98.194:8017/sap/opu/odata/sap/ZDEMO_FIORI_ABO_SRV/"

Here are the other relevant snippets:

index.html

index.html

test/mockServer.html

test/mockServer.html

neo-app.json

neo-app.json

Where I need help: leaving aside why the "web application" start option does not work, I'd like to understand how I could tweak the code in such a way that the cors proxy is correctly invoked on a local installation yet the implicit mockdata option in WebIDE works.

0 Answers
Related