Name: egg-validate
Owner: egg
Description: validate plugin for egg
Created: 2016-07-17 06:23:58.0
Updated: 2018-05-21 09:35:52.0
Pushed: 2018-05-17 00:42:22.0
Homepage: null
Size: 14
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Validate plugin for egg.
see parameter for more information such as custom rule.
m i egg-validate --save
app_root}/config/plugin.js
rts.validate = {
ckage: 'egg-validate',
app_root}/app/controller/home.js
rts.index = function* () {
is.validate({ id: 'id' }); // will throw if invalid
or
nst errors = this.validator.validate({ id: 'id' }, this.request.body);
validator.addRule('jsonString', (rule, value) => {
y {
JSON.parse(value);
catch (err) {
return 'must be json string';
Please open an issue here.