You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to add ODATA V2 support in my HANA -XSA project. I have completed the changes to the package.json and loaded npm odata-v2-proxy on CDS bootstrap. Below is the code.
host:port/odata/v4/catalogservice is working but host:port/odata/v2/catalogservice is not working.
Error:Cannot GET /odata/v2/catalogservice
var https = require("https");
var port = process.env.PORT || 4000;
var express = require("express");
let app = express();
const server = require("https").createServer(app);
const cds = require("@sap/cds");
const xsenv = require("@sap/xsenv");
const xsHDBConn = require("@sap/hdbext");
const xssec = require("@sap/xssec");
const passport = require("passport");
var routerData = require('./router/index');
const proxy = require('@sap/cds-odata-v2-adapter-proxy');
I am trying to add ODATA V2 support in my HANA -XSA project. I have completed the changes to the package.json and loaded npm odata-v2-proxy on CDS bootstrap. Below is the code.
host:port/odata/v4/catalogservice is working but host:port/odata/v2/catalogservice is not working.
Error:Cannot GET /odata/v2/catalogservice
var https = require("https");
var port = process.env.PORT || 4000;
var express = require("express");
let app = express();
const server = require("https").createServer(app);
const cds = require("@sap/cds");
const xsenv = require("@sap/xsenv");
const xsHDBConn = require("@sap/hdbext");
const xssec = require("@sap/xssec");
const passport = require("passport");
var routerData = require('./router/index');
const proxy = require('@sap/cds-odata-v2-adapter-proxy');
xsenv.loadEnv();
https.globalAgent.options.ca = xsenv.loadCertificates();
global.__base = __dirname + "/";
global.__uaa = process.env.UAA_SERVICE_NAME;
passport.use("JWT", new xssec.JWTStrategy(xsenv.getServices({
uaa: {
tag: "xsuaa"
}
}).uaa));
app.use(passport.initialize());
let hanaOptions = xsenv.getServices({hana:{tag:"hana"}});
hanaOptions.hana.pooling = true;
app.use(
xsHDBConn.middleware(hanaOptions.hana)
);
var options = {
kind: "hana",
logLevel: "error"
};
cds.connect(options);
cds.on('bootstrap',(app)=> app.use(proxy());
var odataURL = "/odata/v4/CatalogService/";
cds.serve("gen/csn.json", {
crashOnError: false
})
.at(odataURL)
.with(require("./lib/handlers/cat"))
.in(app)
.catch((err) => {
console.log(err);
process.exit(1);
});
app.use('/node',routerData);
app.get("/", (req, res) => {
res.redirect(odataURL);
});
app.get("/node", (req, res) => {
res.redirect(odataURL);
});
app.listen(port);
The text was updated successfully, but these errors were encountered: