UNPKG

fkc

Version:

FKC application service framework.

18 lines 505 B
'use strict'; module.exports = (obj)=>{ const wk = require('./worker'); const cluster = require('cluster'); if (cluster.isMaster || cluster.isPrimary) { for (let i = 0;i < obj.cluster;i++) { wk(cluster.fork()); }; cluster.on('exit', () => { wk(cluster.fork()); }) }else{ require('./server')(obj); process.on('message', (msg) => { msg === 'goto' && process.send('back'); }) } }