mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2025-06-16 20:31:29 -07:00
factor our cluster into run.js
This commit is contained in:
parent
f5712fef77
commit
a5b32e9d53
2 changed files with 29 additions and 26 deletions
13
run.js
Normal file
13
run.js
Normal 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
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue