1.0.4 • Published 1 year ago

express-middleware-verification v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Express Middleware Verification

This library provides a simple middleware for Express.js applications to filter and ignore specific fields and values from the response data.

Installation

npm install express-middleware-verification

Usage

const expressMiddlewareVerification = require('express-middleware-verification');

const options = {
  ignoreValues: [null, "undefined"],
  ignoreFields: ["password"],
  ignoreIfPresent: ["deleted_at"],
};

app.use(expressMiddlewareVerification(options));

Options

  • ignoreValues (default: [null, "undefined"]) - An array of values to ignore when filtering response data.
  • ignoreFields (default: ["password"]) - An array of field names to ignore when filtering response data.
  • ignoreIfPresent (default: ["deleted_at"]) - If any field in this array is present in an object, the whole object will be ignored.

How it works

  1. The middleware checks if the response data should be ignored based on the presence of any fields specified in ignoreIfPresent.
  2. If the response data should not be ignored, the middleware filters the ignored fields and values.
  3. The filtered response data is then sent as the response.
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago