mirror of
https://github.com/jlengrand/sample-node-api.git
synced 2026-03-10 08:41:23 +00:00
fix npm start,manual start z/os script,health chk
Signed-off-by: Nakul Manchanda <nakul.manchanda@ibm.com>
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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
10
start-sample.sh
Normal 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
|
||||
Reference in New Issue
Block a user