@johnmmackey/ms-utils

Utility functions for Microservice Architecture

Stats

StarsIssuesVersionUpdatedCreatedSize
@johnmmackey/ms-utils
3.3.27 months ago3 years agoMinified + gzip package size for @johnmmackey/ms-utils in KB

Readme

ms-utils

Helper functions to use with Microservices Architecture.

Due to the use of ES6 features, this module requires Node.js V8 or above.

Quick Start

npm install @johnmmackey/ms-utils
const { Utils, Config, winstonMSLoggerFactory, sendmail } = require('@johnmmackey/ms-utils');
winston
    .remove(winston.transports.Console)
    .add(winston.transports.Console, {
        timestamp: true,
        level: 'debug'
    })
    .add(winstonMSLoggerFactory(winston, 'smtpengine', aC), {
        level: 'debug'
    });

const config = await Config.get('logger');
winston.debug('Config:', Utils.maskKeys(config));
let x = Config.get('key');      //typeof string
let y = Config.getObj('key');   // typeof Object

sendmail(
    [
        {"email": "user1@gmail.com","name": "John Smith"},
        {"email": "user2@yahoo.com","name": "Jane Doe"},
        {"email": "user3@aol.com","name": "Karen from Texas"}
    ],
    {
        from: 'info@countryglen.org',
        subject: "Test",
        htmlBody: "<em>This</em> is progress...",
        includeUnsubscribeLink: true
    })
    .then( () => console.log('Success'))
    .catch( err => console.log(err))

Future

  • Add local queueing for log events when AMQP is not operative.
  • Configurable logging setup (drivers)

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.