on 07-14-2022 9:04 AM
Hello,
With @sap/cds-mtx, to add any custom hooks to the server, we used to do following:
const cds = require("@sap/cds");
const middleware = require("./middleware");
cds.env.features.fetch_csrf = true;
cds.on("bootstrap", async (app) => {
// middlewares for mtx
cds.mtx.in(app).then(async () => {
// bind middlewares app.use("/middleware", middleware);
const provisioning = await cds.connect.to("ProvisioningService");
provisioning.impl(require("./provisioning"));
});
});
module.exports = cds.server;
With cds-mtxs, cds.mtx is no longer a valid object. How should we add custom middlewares in this case?
Thanks,
Ashish
The updated section:
// Update Guide
// https://cap.cloud.sap/docs/guides/multitenancy/mtxs#adding-custom-lifecycle-event-handlers
cds.on("served", async (app) => {
// middlewares for mtx
// bind middlewares
// app.use("/middleware", middleware);
// provide SAP BTP dependencies
// https://cap.cloud.sap/docs/guides/deployment/as-saas#sap-btp-dependencies
require("./dependencies")(cds);
const provisioning = await cds.connect.to("cds.xt.SaasProvisioningService");
provisioning.impl(require("./provisioning"));
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.