1.3.6 • Published 1 year ago

express-load-balancer v1.3.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Simple Load Balancer - A Node.js Package for Express Applications This Node.js package provides a simple and efficient way to implement load balancing for your Express applications. It allows you to distribute incoming requests across multiple servers, improving performance and application scalability.

Features:

Express Integration: Seamlessly integrates with your existing Express setup. Multiple Algorithms: Choose from various load balancing algorithms (initial functionality might focus on one specific algorithm, e.g., round robin). Easy Configuration: Configure your load balancer with minimal code. Improved Performance: Enhances application responsiveness under heavy load. Benefits:

Scalability: Easily scale your application by adding more servers. Availability: Ensure your application remains accessible even if a server encounters issues. Simplified Management: Manage multiple servers from a central point.

Installation

npm i express-load-balancer

Usage

const LoadBalancer = require('express-load-balancer')
const dotenv = require('dotenv');
dotenv.config();

const loadBalancer = new LoadBalancer();
const lbPort = process.env.LOAD_BALANCER_PORT || 8000;
loadBalancer.start(lbPort,useStckySession = false,algorithm='ip-hash');

// Initialize servers with different ports
loadBalancer.initializedServers([
  `http://localhost:${process.env.SERVER_PORT_1}`,
  `http://localhost:${process.env.SERVER_PORT_2}`
]);

// Setup load balancer middleware
loadBalancer.app.use((req, res) => {
  loadBalancer.handle(req, res);
});

Now run this file or import this file in your express setup file. Bam your load balancer is up and running.

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago