factor our cluster into run.js

This commit is contained in:
Jeffrey Sun 2017-05-03 16:06:47 -07:00
parent f5712fef77
commit a5b32e9d53
2 changed files with 29 additions and 26 deletions

13
run.js Normal file
View file

@ -0,0 +1,13 @@
const cluster = require('express-cluster');
const app = require('./server.js');
activePort = process.env.PORT || 3000;
cluster((worker) => {
app.listen(activePort, () => {
console.log('worker ' + worker.id + ' is listening on port ' + activePort);
});
}, {
'respawn': true, // workers will restart on failure
'verbose': true, // logs what happens to console
});