lib/index.js
/**
 * Add a number of workers
 * @author amadormf
 * @param  {Number} numWorkers Workers for add
 * @param  {Object} res Response of server
 */
Add a number of workers
@author amadormf
@param  {Number} numWorkers Workers for add
@param  {Object} res Response of server
Add a number of workers @author amadormf @param { Number } numWorkers Workers for add @param { Object } res Response of server
function addWorkers(numWorkers, res){
	var resultAdd = {
		add: []
	};
	for(var i = 0; i < numWorkers; ++i){
		var worker = cluster.fork();
		resultAdd.add.push({
			worker: {
				id: worker.id,
				pid: worker.process.pid				
			}
		});
	}
	res.send(JSON.stringify(resultAdd));
}
function addWorkers ( numWorkers , res ) { var resultAdd = { add : [ ] } ; for ( var i = 0 ; i < numWorkers ; ++ i ) { var worker = cluster . fork ( ) ; resultAdd . add . push ( { worker : { id : worker . id , pid : worker . process . pid } } ) ; } res . send ( JSON . stringify ( resultAdd ) ) ; }
Add a number of workers
 @author amadormf
 @param  {Number} numWorkers Workers for add
 @param  {Object} res Response of server
Add a number of workers @author amadormf @param { Number } numWorkers Workers for add @param { Object } res Response of server