smart-stick-loadbalancer 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Smart Stick Load Balancer
|
|
2
2
|
|
|
3
|
-
A lightweight **sticky-session load balancer** for Node.js. It distributes requests to multiple backends, supports sticky sessions via cookies, performs health checks, and can optionally send email alerts.
|
|
3
|
+
A lightweight **sticky-session load balancer** for Node.js. It distributes requests to multiple backends, supports sticky sessions via cookies, performs health checks, and can optionally send email alerts.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Sticky sessions via cookies
|
|
10
|
-
- Health checks with automatic failover
|
|
11
|
-
- Optional email alerts
|
|
12
|
-
- WebSocket and HTTP support
|
|
13
|
-
- Minimal setup
|
|
9
|
+
- Sticky sessions via cookies
|
|
10
|
+
- Health checks with automatic failover
|
|
11
|
+
- Optional email alerts
|
|
12
|
+
- WebSocket and HTTP support
|
|
13
|
+
- Minimal setup
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
@@ -25,6 +25,7 @@ npm install smart-stick-loadbalancer
|
|
|
25
25
|
## Example Configuration (`config.json`)
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
|
+
module.exports = {
|
|
28
29
|
{
|
|
29
30
|
"port": 3001,
|
|
30
31
|
"backends": [
|
|
@@ -37,6 +38,7 @@ npm install smart-stick-loadbalancer
|
|
|
37
38
|
"auth": { "user": "<your-email@gmail.com>", "pass": "<your-app-password>" }
|
|
38
39
|
}
|
|
39
40
|
}
|
|
41
|
+
};
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
---
|
|
@@ -44,16 +46,16 @@ npm install smart-stick-loadbalancer
|
|
|
44
46
|
## Usage
|
|
45
47
|
|
|
46
48
|
```js
|
|
47
|
-
const { createStickyProxy } = require(
|
|
48
|
-
const config = require(
|
|
49
|
+
const { createStickyProxy } = require("smart-stick-loadbalancer");
|
|
50
|
+
const config = require("./config.json");
|
|
49
51
|
|
|
50
52
|
const lb = createStickyProxy(config);
|
|
51
53
|
lb.start(); // starts the load balancer
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
- Requests to `http://localhost:3001` will be forwarded to the backends.
|
|
55
|
-
- Sticky sessions are automatically managed using cookies.
|
|
56
|
-
- Health checks run periodically and remove unhealthy backends from rotation.
|
|
56
|
+
- Requests to `http://localhost:3001` will be forwarded to the backends.
|
|
57
|
+
- Sticky sessions are automatically managed using cookies.
|
|
58
|
+
- Health checks run periodically and remove unhealthy backends from rotation.
|
|
57
59
|
|
|
58
60
|
---
|
|
59
61
|
|
|
@@ -82,8 +84,8 @@ Response example:
|
|
|
82
84
|
|
|
83
85
|
## Email Alerts
|
|
84
86
|
|
|
85
|
-
- Alerts are sent when a backend goes down or comes back up.
|
|
86
|
-
- Requires valid Gmail credentials (or any supported email service).
|
|
87
|
+
- Alerts are sent when a backend goes down or comes back up.
|
|
88
|
+
- Requires valid Gmail credentials (or any supported email service).
|
|
87
89
|
|
|
88
90
|
---
|
|
89
91
|
|
package/package.json
CHANGED