🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more →
Socket
Book a DemoInstallSign in
Socket

@koyfin/ms-basement

Package Overview
Dependencies
Maintainers
7
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@koyfin/ms-basement

Koyfin microservices basement

unpublished
latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
7
Created
Source

MS-Basement package

Overview

This package is the base for each microservice, which provides an interface for implementation by derived application. It powers up boundaries, handles startup and graceful shutdown, binds basic Node.js process event handlers.

Installation

This package is a part of Koyfin microservices generator and does not need explicit installation in general case, but it still can be used as a standalone application base:

npm install @koyfin/basement

Usage

New application is created by extending the Basement class and overriding constructor arguments, startSequence and stopSequence methods.

//src/app.js
const Basement = require('@koyfin/ms-basement');
const settings = require('./settings');

const boundaries = {
  inbound: require('./boundaries/inbound'),
  outbound: require('./boundaries/outbound'),
};

module.exports = class App extends Basement {
  /**
   * @todo If necessary, implement custom logger
   */
  constructor() {
    super({ settings, boundaries });
  }

  async startSequence() {
    await this.boundaries.inbound.init();
    await this.boundaries.outbound.init();
  }

  async stopSequence() {
    await this.boundaries.outbound.stop();
    await this.boundaries.inbound.stop();
  }
};

After that, instantiate the application and call it's public start method:

// src/index.js
const App = require('./app');

const app = new App();

app.start();

FAQs

Package last updated on 05 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts