bonzai

1.0.3 • Public • Published

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

Package Sidebar

Install

npm i bonzai

Weekly Downloads

7

Version

1.0.3

License

none

Last publish

Collaborators

  • lugrugzo