npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

general-cluster

v1.0.1

Published

express running on node clusters

Downloads

4

Readme

General Cluster

General Cluster is a utility for running an Express application on a Node Cluster.

  • 550 Bytes unzipped
  • Express is the only dependency
  • Available as an npm package

To learn about using Clusters with Node, please explore the appendix.

Current Stable Release Version Current Stable npm Release


Created by Clark Feusier


  1. Installation
  2. Basic Usage Example
  3. Contributing
  4. Development Requirements
    1. Installing Development Requirements
    2. Development Dependencies
    3. Installing Development Dependencies
    4. Building for Deployment
  5. License
  6. Appendix

Installation

General Cluster is available as an npm package, which you can install from the command-line:

npm install general-cluster

Then, require the General Cluster module for use in a desired file:

var GeneralCluster = require('general-cluster');

Basic Usage Example

General Cluster is simple to use.

  1. Setup your Express application as you normally would
  2. Instead of calling listen() to start your Express server, pass your application to General Cluster, along with the options that you would normally pass to .listen
  3. Your application will then be served from a node cluster
var GeneralCluster = require('general-cluster'),
    express = require('express'),
    app = express();

// setup express application configuration and routes, e.g.,
app.get('/*', function(req, res) {
  res.send('Hello World');
});

var optionalPort = 3000;
var optionalListeningCb = function() {
  console.log("The General is listening on port: " + optionalPort);
};
var optionalHostName = '127.0.0.1';
var optionalBacklog = 511;

// pass configured express app to GeneralCluster to start server
var clusterAppDefaultListenArgs = GeneralCluster(app);
// optionally: pass along a port, hostname, backlog, or callback (see https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback)
// NOTE: the callback will be triggered for each process that binds to the given port
var clusterAppCustomListenArgs = GeneralCluster(app, optionalPort, optionalHostName, optionalBacklog, optionalListeningCb);

Contributing to General Cluster

We welcome contributions, but please read our contribution guidelines before submitting your work. The development requirements and instructions are below.

Development Requirements

  • Node 0.10.x
  • npm 2.x.x

Installing Development Requirements

Install Node (bundled with npm) using Homebrew:

brew install node

Development Dependencies

  • grunt-cli (global install)
  • grunt
  • grunt-contrib-uglify

Installing Development Dependencies

Install project and development dependencies using npm:

npm install

Building for Deployment

To build src/general-cluster.js into dist/general-cluster.min.js, use the following grunt task:

grunt build

License

General Cluster - express running on node clusters

Copyright (C) 2015 Clark Feusier [email protected] - All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

COMPLETE LICENSE


Appendix

From the Node Cluster documentation:

A single instance of Node runs in a single thread. To take advantage of multi-core systems, one can launch a cluster of Node processes to handle the load. Using Node's cluster allows one to easily create child processes that all share server ports.

Back to Top


© 2015 Clark Feusier. All rights reserved.