diff --git a/index.js b/index.js index bae9fef..829265e 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,10 @@ require('dotenv').config(); +var http = require('http'); const cluster = require('node:cluster'); const totalCPUs = require('node:os').cpus().length; const process = require('node:process'); const winston = require('./application/helpers/winston.logger'); -const server = require('./server'); +const app = require('./server'); const sticky = require('sticky-session'); // set port, listen for requests @@ -44,6 +45,7 @@ if (cluster.isMaster) { cluster.on('exit', (worker, code, signal) => { console.log(`worker ${worker.process.pid} died`); console.log("Let's fork another worker!"); + console.log('with code: ' + code); cluster.fork(); }); } else { @@ -56,11 +58,20 @@ if (cluster.isMaster) { // startExpress(); function startExpress() { - sticky.listen(server, PORT, () => { + // var server = http.createServer(app); + // sticky.listen(server, PORT); + // winston.logger.info( + // `Server is running with sticky session on version ${ + // process.env.VERSION + // } environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} ` + // ); + // } else { + app.listen(PORT, () => { winston.logger.info( `Server is running on version ${ process.env.VERSION } environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} ` ); }); + // } }