1.1.2 • Published 4 years ago

egg-validate2 v1.1.2

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

egg-validate2

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-validate2 --save

Usage

// {app_root}/config/plugin.js
exports.validate = {
  enable: true,
  package: 'egg-validate2',
};

Configuration

// {app_root}/config/config.default.js
exports.validate = {
};

see config/config.default.js for more detail.

Example

'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
    async index() {
        const { ctx } = this;

        await ctx.validator().validate({title: [{required: true, message: 'title is required!'}]},ctx.request.query);

        ctx.body = 'hi, egg';
    }
}

module.exports = HomeController;

See async-validator for more information such as custom rule.

Questions & Suggestions

Please open an issue here.

License

MIT

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago