fib-loadbalancer

1.0.0 • Public • Published

fib-loadbalancer

Introduction

Load balance module for fibjs.

Installation

npm install fib-loadbalancer

or

fibjs --install fib-loadbalancer

Example

...
const http = require('http');
let repeater = require('fib-loadbalancer');
 
let params = {
    urls: ["http://127.0.0.1:8093", "http://127.0.0.1:8092", "http://127.0.0.1:8091"],
    health: "health",
    response: 'true'
}
 
var httpServer = new http.Server(8081, [
    (req) => {
        req.session = {}
    }, {
        "*": repeater(params)
    }
]);
...

Precautions

In params, urls is a required parameter, health and response are optional parameters. Health default is 'health', if the route provided by the user for health check is not 'health', the health parameter of the specified route needs to be filled in. Response default is 'true', if the response provided by the user for health check is not 'true', the response parameter of the specified route needs to be filled in.

example code

/fib-loadbalancer/

    Package Sidebar

    Install

    npm i fib-loadbalancer

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    6.41 kB

    Total Files

    6

    Last publish

    Collaborators

    • d3j