Skip to Content
0
Mar 30, 2020 at 03:39 PM

@sap/cds-odata-v2-adapter-proxy deployed to CF

546 Views Last edit Mar 30, 2020 at 03:41 PM 2 rev

Dear CAP Experts,

I've created a sample CAP application bookshop_odatav2 based on the bookshop scenario. After some adaptations, the application has been deployed successfully to Cloud Foundry and works as expected.

Then I added the @sap/cds-odata-v2-adapter-proxy as indicated in the package readme file:

### CDS combined backend (Node.js) - integrated
In your existing `@sap/cds` project:
- Run `npm install @sap/cds-odata-v2-adapter-proxy -s`

- Create new file `server.js` in the service folder `srv` of your project: `./srv/server.js`

"use strict"; 
const cds = require("@sap/cds");
const proxy = require("@sap/cds-odata-v2-adapter-proxy");
cds.on("bootstrap", app => app.use(proxy()));
module.exports = cds.server;

That works fine when running locally, so http://localhost:4004/catalog/Authors produces an OData v4 output and http://localhost:4004/v2/catalog/Authors a v2 output, but doesn't work after deploying it to Cloud Foundry, cause the output is always in OData v4.

Is there anything else to do to deploy the app an get a v2 output when running on cloud foundry?

Thanks in advance.

Best regards,

Marc