service-registry
v0.0.1
Published
A simple registry to associated versioned service names with host/ip info
Downloads
1
Readme
service-registry
A simple registry to associated versioned service names with host/ip info
Installation
npm install service-registry
Example
See test/registry.spec.coffee for all usage examples
Registering a service
var Registry = require('service-registry');
var r = new Registry();
r.register('[email protected]', '127.0.0.1', 80, { additionalExampleField: 'world'});
Getting a service
var info = r.get('[email protected]');
info
then contains:
{
"name": "hello-service",
"fullName": "[email protected]",
"version": "1.0.2",
"host": "127.0.0.1",
"port": 80,
"meta": {
"additionalExampleField": "world"
}
}
Note: You must use the same
Registry
instance
Listing all services
var services = r.services();
services
then contains an array of info instances as above
Unregistering a service
r.unregister('[email protected]');
Tests
npm test
Development
When developing install all packages after cloning (npm i
) and then run npm run-script dev
.
The dev script runs nodemon test.js
(if nodemon is not installed, just install it with npm i -g nodemon
) and also connects to growl to notify the developer about any errors during development (this is done via cura-test-runner)