egg-validate
Validate plugin for egg.
See parameter for more information such as custom rule.
Install
$ npm i egg-validate --save
Usage
// config/plugin.jsexportsvalidate = enable: true package: 'egg-validate';
Configurations
egg-validate support all parameter's configurations, check parameter documents to get more infomations.
// config/config.default.jsexportsvalidate = // convert: false, // validateRoot: false,;
Validate Request Body
// app/controller/home.jsexports { this; // will throw if invalid // or const errors = thisappvalidator;};
Extend Rules
- app.js
appvalidator;
Questions & Suggestions
Please open an issue here.