bonzai
Node.js easy cluster module
Simple usage
You can install it using NPM with this command:
npm i --save bonzai
And then call it
var bonzai = require('bonzai')
bonzai({
workerCount: 1,
workerFunc: function() {
//
},
autoSpawn: true,
logging: true
})
Express example
function server() {
var express = require('express')
var app = express()
app.get("/", function(req, res) {
res.send("It works")
})
app.listen(3333)
}
var bonzai = require('bonzai')
bonzai({
workerCount: 1,
workerFunc: server,
autoSpawn: true,
logging: true
})
Options
Variable | Type | Default |
---|---|---|
workerCount | integer | cpu count |
workerFunc | function | |
autoSpawn | boolean | true |
logging | boolean | false |