Skip to content

dlion/toxiproxy-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

toxiproxy-node

Toxiproxy Node Client

Install

npm install toxiproxy-node

Usage Example

var toxiproxy = require('toxiproxy-node');

//New Client
var client = new toxiproxy('localhost:8474');

//New Proxy
var redis = client.NewProxy({
  name: 'Redis',
  listen: '127.0.0.1:26375',
  upstream: '127.0.0.1:6375'
});

//Create redis Proxy
redis.Create(function(err, body) {
  if(!err) {
    //Set Latency
    redis.SetToxic('latency', 'downstream', {
      enabled: true,
      latency: 1000
    }, function(err, body) {
      //Show Redis downstream info
      redis.Toxics('downstream', function(err, body) {
        if(!err) {
          console.log(body);
          //Delete Redis Proxy
          redis.Delete(function(){});
        }
      });
    });
  }
});

Author

License

MIT 2015 Domenico Luciani domenicoleoneluciani@gmail.com

Releases

No releases published

Packages

No packages published