Skip to content

Commit 0e548b8

Browse files
committed
feat(integration): noderfc on btp sample update
1 parent 5d4d660 commit 0e548b8

File tree

116 files changed

+75
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+75
-38
lines changed

integration/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const express = require("express");
2+
const rfc = require("node-rfc");
3+
const fs = require("fs");
4+
const app = express();
5+
6+
const directoryPath = process.env.SAPNWRFC_HOME;
7+
const filenames = directoryPath ? fs.readdirSync(directoryPath) : [];
8+
function environment() {
9+
return [
10+
"HOME",
11+
process.env.HOME,
12+
"\nSAPNWRFC_HOME",
13+
process.env.SAPNWRFC_HOME,
14+
"\nSAPNWRFC_HOME files:",
15+
JSON.stringify(filenames),
16+
"\nLD_LIBRARY_PATH",
17+
process.env.LD_LIBRARY_PATH,
18+
"\nnode-rfc",
19+
JSON.stringify(rfc.environment, null, 4),
20+
].join("\n");
21+
}
22+
23+
app.use(express.json());
24+
25+
const rfcPool = new rfc.Pool({ connectionParameters: { dest: "MME" } });
26+
27+
app.route("/user/:userId").all(async (req, res) => {
28+
try {
29+
const rfcClient = await rfcPool.acquire();
30+
const user = await rfcClient.call("BAPI_USER_GET_DETAIL", {
31+
USERNAME: req.params.userId || "DEMO",
32+
});
33+
res.send(JSON.stringify(user, null, 4));
34+
} catch (ex) {
35+
res.json(ex.message);
36+
}
37+
});
38+
39+
app.get(["", "/"], function (req, res) {
40+
res.send(environment());
41+
});
42+
43+
const port = process.env.PORT || 3000;
44+
const server = app.listen(port, async function (port) {
45+
try {
46+
const host = server.address().address;
47+
const port = server.address().port;
48+
console.log(`Server running on http://${host}:${port}`);
49+
console.log(environment());
50+
} catch (ex) {
51+
console.log(ex);
52+
}
53+
});

integration/noderfc_with_nwrfcsdk/buildpack/app/node-rfc/binding.gyp integration/noderfc_btp/buildpack/app/node-rfc/binding.gyp

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
{
88
'variables': {
9-
# 'nwrfcsdk_dir': '<!(echo $SAPNWRFC_HOME)',
9+
# required for initial build from source
10+
#'nwrfcsdk_dir': '<!(echo $SAPNWRFC_HOME)',
11+
# required for BTP deployment, can be set after build
1012
'nwrfcsdk_dir': '/tmp/app/node_modules/nwrfcsdk',
1113
'nwrfcsdk_include_dir': "<(nwrfcsdk_dir)/include",
1214
'nwrfcsdk_lib_dir': "<(nwrfcsdk_dir)/lib",

integration/noderfc_with_nwrfcsdk/buildpack/app/node-rfc/package-lock.json integration/noderfc_btp/buildpack/app/node-rfc/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/noderfc_with_nwrfcsdk/buildpack/app/node-rfc/package.json integration/noderfc_btp/buildpack/app/node-rfc/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"lintcpp": "clang-tidy src/cpp/*.cc -- -I/usr/local/sap/nwrfcsdk/include -Inode_modules/node-addon-api -I$NVM_BIN/../include/node",
4242
"lintts": "eslint src/ts test --ext ts",
4343
"test": "jest test --testPathIgnorePatterns throughput --testTimeout 60000",
44-
"cpp": "prebuildify --napi -t 16.20.0 -t [email protected] --force --strip --verbose",
45-
"dev": "prebuildify --napi -t 16.20.0 --force --strip --verbose",
44+
"cpp": "prebuildify --napi -t 18.18.2 -t [email protected] --force --strip --verbose",
45+
"dev": "prebuildify --napi -t 18.18.2 --force --strip --verbose",
4646
"ts": "tsc",
4747
"build": "npm run ts && npm run cpp",
4848
"rebuild": "npm install --build-from-source"
@@ -79,7 +79,7 @@
7979
"typescript": "^5.0.2"
8080
},
8181
"engines": {
82-
"node": "^16 || ^18 || >= 20"
82+
"node": "^18 || >= 20"
8383
},
8484
"gypfile": true
8585
}

integration/noderfc_with_nwrfcsdk/buildpack/app/package-lock.json integration/noderfc_btp/buildpack/app/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/noderfc_with_nwrfcsdk/buildpack/app/package.json integration/noderfc_btp/buildpack/app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"main": "index.js",
99
"scripts": {
1010
"start:btp": "node index.js",
11+
"setnwrfcenv": "export SAPNWRFC_HOME=`pwd`/nwrfcsdk && export LD_LIBRARY_PATH=$SAPNWRFC_HOME/lib",
1112
"test": "echo \"Error: no test specified\" && exit 1"
1213
},
1314
"dependencies": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DEST=MME
2+
USER=demo
3+
PASSWD=welcome
4+
ASHOST=10.68.110.51
5+
SYSNR=00
6+
CLIENT=620
7+
LANG=EN
8+
TRACE=0

integration/noderfc_with_nwrfcsdk/buildpack/app/index.js

-31
This file was deleted.

0 commit comments

Comments
 (0)