Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

boring-cluster

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boring-cluster

A really boring cluster module

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

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')
const { resolve } = require('path')
// `thing` could be a server, or any other process you want to cluster
const thing = resolve(__dirname, 'thing')

cluster(thing)

Full example with an Express server:

// index.js
const cluster = require('boring-cluster')
const { resolve } = require('path')
cluster(resolve(__dirname, 'server'))

// 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}`)
})

This is tested on Node as far back as 4.1.2, and may work on even more ancient versions.

License

MIT

Keywords

FAQs

Package last updated on 18 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc