foxy-moxy/run.js

14 lines
375 B
JavaScript
Raw Normal View History

2017-06-13 01:39:14 +00:00
const cluster = require('express-cluster')
const app = require('./server.js')
2017-05-03 23:06:47 +00:00
2017-06-13 01:39:14 +00:00
const activePort = process.env.PORT || 3000
2017-05-03 23:06:47 +00:00
cluster((worker) => {
2017-06-13 01:39:14 +00:00
app.listen(activePort, () => {
console.log('worker ' + worker.id + ' is listening on port ' + activePort)
})
2017-05-03 23:06:47 +00:00
}, {
2017-06-13 01:39:14 +00:00
'respawn': true, // workers will restart on failure
'verbose': true // logs what happens to console
})