nats-server-control
v0.0.1
Published
Control the gnatsd process with javascript. Useful in testing purposes. This originates from https://github.com/nats-io/node-nats
Downloads
157
Readme
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.