cloud-client
Usage
ResourceClient
;;const SERVICE_NAME = 'a-service';const cClient = SERVICE_NAME resourceInterface;//set health check.cClient;//register http request api.;
ResourceInterface
;/*** Check the service's health status.*/{return;}{return;}
You can use cloud client to invoke resource interface's function. example is
;resourceClient;
API
new CloudClient(serviceName, interface, options)
serviceName
The service name.
interface
The key-value object for sending request.
options
- logger: Default is console. you can use any other logger that implements logger.log function.
- Other options param is the same as brakes
cClient.setHealthCheck(callback)
Set a callback, when the circuit is open, the callback will be used for checking the service's health status, if the status is ok, the circuit will close.
cClient.registerApi()
return cClient.registerApi();