Hi SAP!
I was experimenting to build a full-stack app on cloud foundry with a nodejs and a html5 module. I first created a MTA without html5 app repo and it worked fine (especially routing, what this question will be about). Then I created a MTA with a html5 app repo (I checked the checkbox, when creating the html5 module) to take advantage of it and now routing to my nodejs-backend-module does not work anymore. There's always an internal server error.
I've read on the sap help site, that when using html5 app repo AND approuter, the property "destination" is not supported (which I had in the mta without html5 app repo to forward request to the module). So how can I forward requests to my backend module then?
The following shows the approuter with the route to the html5 app repo. When I add a second route with property destination, it does not work anymore.
{ "welcomeFile": "/index.html", "authenticationMethod": "route", "logout": { "logoutEndpoint": "/do/logout" }, "routes": [{ "source": "^/(.*)$", "target": "$1", "service": "html5-apps-repo-rt", "authenticationType": "xsuaa" },{ // PART THAT DOES NOT WORK "source": "^/api/([a-z]+)", "target": "/$1", "destination": "nodejs_repo_api" } ] }
This is mta.yaml file:
ID: mta_test_modules_repo _schema-version: '2.1' parameters: deploy_mode: html5-repo version: 0.0.1 modules: - name: mta_test_modules_repo_appRouter type: approuter.nodejs path: mta_test_modules_repo_appRouter parameters: disk-quota: 256M memory: 256M requires: - name: mta_test_modules_repo_html5_repo_runtime - name: uaa_mta_test_modules_repo - name: mta_test_modules_repo_ui_deployer type: com.sap.html5.application-content path: mta_test_modules_repo_ui_deployer requires: - name: mta_test_modules_repo_html5_repo_host build-parameters: requires: - name: destination_service_frontend artifacts: - './*' target-path: resources/destination_service_frontend - name: nodejs_repo type: nodejs path: nodejs_repo provides: - name: nodejs_repo_api properties: url: '${default-url}' - name: destination_service_frontend type: html5 path: destination_service_frontend parameters: disk-quota: 500M memory: 500M build-parameters: builder: grunt requires: - name: nodejs_repo_api group: destinations properties: name: nodejs_repo_api url: '~{url}' forwardAuthToken: true - name: uaa_mta_test_modules_repo resources: - name: mta_test_modules_repo_html5_repo_runtime parameters: service-plan: app-runtime service: html5-apps-repo type: org.cloudfoundry.managed-service - name: mta_test_modules_repo_html5_repo_host parameters: service-plan: app-host service: html5-apps-repo type: org.cloudfoundry.managed-service - name: uaa_mta_test_modules_repo parameters: path: ./xs-security.json service-plan: application service: xsuaa type: org.cloudfoundry.managed-service - name: dest_mta_test_modules_repo parameters: service-plan: lite service: destination type: org.cloudfoundry.managed-service