1.0.4 • Published 4 years ago

@tradeshack/api-validator v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Tradeshack API Validator

Api Validator is a lightweight wrapper around express-validator. It provides out of the box error messages for common validation errors. It allows for automatic rule execution on express routes.

Installation

npm install --save @tradeshack/api-validator

Usage

const { validate, rule } = require('@tradeshack/api-validator');

app.post(
  '/accept/:token',
  validate([
    rule('firstName').nonEmpty(),
    rule('lastName').nonEmpty(),
    rule('email').nonEmpty(),
    rule('password').nonEmpty().isMinLength(5),
  ]),
  (request, response) => {});
1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago