@blingz/service-registry

1.0.4 • Public • Published

Description

A simple express middleware for adding an additional REST endpoint to manage services registration.

Installation

npm install --save @blingz/service-registry

Usage

//
// Imports
//

var express = require("express");
var bodyParser = require("body-parser");
var serviceRegistry = require('@blingz/service-registry');

const PORT = 3000;

//
// Main
//

var app = express();

var serviceRegistryMiddleware = serviceRegistry(app, {
	subscriptionUrl: "/api/service-registry",
	subscriptionAuthorizationToken: "authorization-token",
	enableLogging: true
});

app.use(bodyParser.json());
app.use(serviceRegistryMiddleware);

app.listen(PORT, ()=> {
	console.log("Service registry started on port", PORT);
});

/*
now you can perform a POST or PUT on http://localhost:3000/api/service-registry
with body {"serviceKey":"WEBUI01","serviceUrl":"http://service-ip"}
and you can perform a GET on http://localhost:3000/api/service-registry to get the available registered services
*/

License

MIT THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i @blingz/service-registry

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

6.78 kB

Total Files

4

Last publish

Collaborators

  • blingz