6.1.5 • Published 2 years ago
boring-cluster v6.1.5
boring-cluster
A really boring cluster module
Installation
npm i boring-cluster
Usage
This is all you need to do:
const cluster = require('boring-cluster')
// `thing` could be a server, or any other process you want to cluster
cluster('./thing')
An optional second argument can be passed with the shape
{ workers: number, name: string }
Example:
cluster('some-thing', { workers: 2, name: 'My Awesome App' })
Full example with an Express server:
// index.js
require('boring-cluster')(
'server',
{ name: 'sweet server', workers: 2 }
)
// server.js
const cluster = require('cluster') // node builtin cluster
const express = require('express')
const port = 2000
const app = express
// all your application-specific stuff goes here
app.use(express.static(__dirname))
app.listen(port, () => {
console.log(`Cluster worker ${cluster.worker.id} listening on ${port}`)
})
Changes
- 5.0.0 - 5th January 2019:
- Bump min
engines
support to Node 10 (LTS)
- Bump min
- 4.0.0 - 22nd September 2018:
- Drop Node 6 support
- 3.0.0 - 6th May 2018:
- Resolve module internally
- To upgrade, change
cluster(resolve(__dirname, 'foo'))
tocluster('foo')
6.1.4
2 years ago
6.1.5
2 years ago
6.1.2
3 years ago
6.1.1
3 years ago
6.1.3
3 years ago
6.1.0
3 years ago
6.0.9
5 years ago
6.0.8
5 years ago
6.0.7
5 years ago
6.0.6
5 years ago
6.0.5
5 years ago
6.0.4
5 years ago
6.0.3
6 years ago
6.0.2
6 years ago
6.0.1
6 years ago
6.0.0
6 years ago
5.0.6
6 years ago
5.0.5
6 years ago
5.0.4
6 years ago
5.0.3
6 years ago
5.0.2
6 years ago
5.0.1
6 years ago
5.0.0
7 years ago
4.0.1
7 years ago
4.0.0
7 years ago
3.0.0
7 years ago
2.0.4
7 years ago
2.0.3
7 years ago
2.0.2
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.1.2
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago