0.0.1 • Published 8 years ago

nats-server-control v0.0.1

Weekly downloads
92
License
MIT
Repository
github
Last release
8 years ago

NATS Server Control

This has been cherry picked from node-nats and slightly modified to allow promise syntax. Kudos to Apcera and the author(s) of that repo!

Start, stop and kill the gnatsd process from javascript. Useful during testing where a NATS bus is needed.

Start and stop a NATS server

var nsc = require('nats-server-control');

// Start gnatsd on localhost:4222 
var server = nsc.startServer(4222, { /* optional opts })
  .then(function() {
     // up an running
  })
  .catch(function(err) {
    // catch error
  });

// Stop server
nsc.stopServer(server);

// Or if you'd like
// server.kill();

Example

Check out spec/example.spec.js for example usage in a jasmine test.