/common-middleware

Common middleware for Node.js apps

Primary LanguageJavaScript

Common Middleware

Common middleware for Node.js apps

Available Middleware

Exported functions accept an optional options object and return ExpressJS middleware.

Install

Create a local .npmrc file with Artifactory authentication. Where username and password are your own Artifactory credentials, run:

curl -u username:password https://pillarproject.jfrog.io/pillarproject/api/npm/auth >> .npmrc

Install the most recent exact version and save to your dependencies.

npm i -PE @pillarwallet/common-middleware

Access Control Headers

Common access control headers.

Example usage:

const { accessControlHeaders } = require('@pillarwallet/common-middleware');

app.use(accessControlHeaders());

Error Handler

Error handling middleware that handles and accepts Boom error objects.

Accepts an optional Bunyan logger such as Common Logger.

Example usage:

const { errorHandler } = require('@pillarwallet/common-middleware');

app.use(errorHandler({ logger }));

Test

npm test