1.0.1 • Published 2 years ago

@blingz/express-service-registry-subscriber v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Description

A simple express middleware for register the service set into a remote service register. The communication (register/unregister) is http and convention-based.

Installation

npm install --save @blingz/express-service-registry-subscriber

Usage

//
// Imports
//

var express = require("express");
var expressServiceRegistryPublisher = require('@blingz/express-service-registry-subscriber');

const PORT = 3001;
const URL = "http://localhost:" + PORT;

//
// Main
//

var app = express();

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

var expressServiceRegistryPublisherMiddleware = expressServiceRegistryPublisher({
	serviceKey: "WEB01",
	serviceGroup: "WEB",
	serviceUrl: URL,
	serviceDescription: "A free description of this service",
	endpointPingUrl: "/api/is-alive",
	registries: [
		{ url: "http://localhost:3000/api/service-registry", authorizationToken: "authorization-token" }
	],
	enableLogging: true
});

app.use(expressServiceRegistryPublisherMiddleware);

app.use((req, res) => {
	res.send({success: true);
});

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.

1.0.1

2 years ago

1.0.0

2 years ago