dorbel-tech / dorbel-shared

dorbel shared dependencies used in dorbel-app
0 stars 1 forks source link

dorbel-shared library Build Status codecov

Shared library for use in dorbel services.

How to add to project :

How to use

const shared = require('dorbel-shared');

Logger

const logger = shared.logger.getLogger(module);
// Variables come first, in an object
// Messages are constant (no variables)
logger.info({ userId: user.id, apartmentId: apartment.id }, 'added apartment');

Koa middleware

Error handler

const app = koa();
// Should come first so it catches all error
app.use(shared.middleware.errorHandler());

Request logger

// Should come right after error handler so it logs all requests and times the entire flow
app.use(shared.middleware.requestLogger());

Swagger Model Validator

Utils

waitForConnection

messageBus

userManagement

Server Runner

shared.utils.serverRunner.startCluster(runMyServer);



## How to test
- Run unit tests using ``yarn test``