Wondering what’s next for npm?Check out our public roadmap! »

    This package has been deprecated

    Author message:

    this package is not supported anymore, you must not use it

    @koyfin/ms-basement

    1.0.4 • Public • Published

    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();

    Keywords

    none

    Install

    npm i @koyfin/ms-basement

    DownloadsWeekly Downloads

    0

    Version

    1.0.4

    License

    UNLICENSED

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar