fix npm start,manual start z/os script,health chk

Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
This commit is contained in:
Nakul Manchanda
2020-07-07 00:54:40 -04:00
parent b8bd9fe5e1
commit 3b38eeec2b
3 changed files with 24 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "node server/app.js",
"start": "node server/app.js --service sample-node-api --port 8080 --key sslcert/server.key --cert sslcert/server.cert",
"build": "npm run clean && cp -r server dist/server && cp -r bin dist/bin && cp *.yml dist && cp *.json dist && cp *.js dist && rimraf dist/package-lock.json",
"clean": "rimraf dist && mkdirp dist"
},

View File

@@ -130,13 +130,22 @@ app.use(cors());
const routes = require('./routes/index.route');
app.get('/', (req, res) => res.send('Hello World!'));
app.get('/health', (req, res) => {
const healthcheck = {
uptime: process.uptime(),
message: 'OK',
timestamp: Date.now()
};
res.send(JSON.stringify(healthcheck));
});
app.use(routes);
// const httpServer = http.createServer(app);
const httpServer = http.createServer(app);
const httpsServer = https.createServer(credentials, app);
// httpServer.listen(HTTP_PORT);
httpsServer.listen(config.port);
console.log(`server listening at port ${config.port}`);
httpServer.listen(config.port);
httpsServer.listen(config.port+1);
console.log(`http server listening at port ${config.port}`);
console.log(`https server listening at port ${config.port + 1}`);
module.exports = { app };

10
start-sample.sh Normal file
View File

@@ -0,0 +1,10 @@
## start locally
node server/app.js --service sample-node-api --port 8080 --key sslcert/server.key --cert sslcert/server.cert -v
## start on z/os uss
KEYSTORE_DIRECTORY=/u/nakul/zowe/keystore
KEYSTORE_ALIAS=localhost
KEYSTORE_PREFIX="${KEYSTORE_DIRECTORY}/${KEYSTORE_ALIAS}/${KEYSTORE_ALIAS}.keystore"
KEYSTORE_KEY=${KEYSTORE_PREFIX}.key
KEYSTORE_CERTIFICATE=${KEYSTORE_PREFIX}.cer-ebcdic
node server/app.js --service sample-node-api --port 19000 --key ${KEYSTORE_KEY} --cert ${KEYSTORE_CERTIFICATE} -v