@johnmmackey/ms-utils
v4.0.1
Published
Utility functions for Microservice Architecture
Downloads
18
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": "[email protected]","name": "John Smith"},
{"email": "[email protected]","name": "Jane Doe"},
{"email": "[email protected]","name": "Karen from Texas"}
],
{
from: '[email protected]',
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)