Skip to content

fibjs/fib-loadbalancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Load balance module for fibxs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •