1.7.0 ā€¢ Published 6 months ago

chokepoint v1.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Chokepoint

Chokepoint is a powerful Node.js package designed to streamline HTTP/HTTPS load balancing in your applications. It distributes incoming traffic across multiple nodes using Round Robin algorithm, ensuring optimal resource utilization and enhanced performance.

NPM npm GitHub contributors GitHub last commit (branch) npm

HTTP load balancing

import Chokepoint from "chokepoint";

const nodes = [
  { host: "localhost", port: 8001 },
  { host: "localhost", port: 8002 },
  { host: "localhost", port: 8003 },
];
const chokepoint = new Chokepoint(nodes);

chokepoint.listen(80, () => {
  console.log("Load balancer is running");
});

HTTPS load balancing

import Chokepoint from "chokepoint";

const nodes = [
  { host: "localhost", port: 8001 },
  { host: "localhost", port: 8002 },
  { host: "localhost", port: 8003 },
];
const chokepoint = new Chokepoint(nodes);

// Configure SSL certificate before listen
chokepoint.secure({
  key: fs.readFileSync("./ssl-key.pem"),
  cert: fs.readFileSync("./ssl-cert.pem"),
});

chokepoint.listen(443, () => {
  console.log("Secure load balancer is running");
});

Enable CORS

import Chokepoint from "chokepoint";

const nodes = [
  { host: "localhost", port: 8001 },
  { host: "localhost", port: 8002 },
  { host: "localhost", port: 8003 },
];
const chokepoint = new Chokepoint(nodes);

// Enable CORS for your request origins before listen
chokepoint.cors(["https://example.com"]);

chokepoint.listen(80, () => {
  console.log("Load balancer is running");
});

šŸš€ Excited to kickstart this project! Your support means the world to us. Please give us a star ā­ļø on GitHub to show your encouragement and help us grow! Let's build something amazing together! šŸŒŸ

1.7.0

6 months ago

1.6.0

6 months ago

1.5.0

6 months ago

1.4.0

6 months ago

1.3.0

7 months ago

1.1.0

7 months ago

1.0.0

7 months ago