@jdfed/drip-form-plugin-eggjs
v0.2.0-alpha.0
Published
drip-form eggjs插件
Downloads
2
Readme
drip-form-plugin-eggjs
drip-form plugin for eggjs.
Install
$ npm i @jdfed/drip-form-plugin-eggjs --save
Usage
// {app_root}/config/plugin.js
exports.dripValidator = {
enable: true,
package: '@jdfed/drip-form-plugin-eggjs',
};
Example
// app/controller/home.js
const Controller = require('egg').Controller;
class HomeController extends Controller {
async index() {
const rules = {
type: 'object',
properties: {
name: {
type: 'string',
},
age: {
type: 'integer',
},
},
required: [
'name',
'age',
],
};
this.ctx.validateBySchema(rules);
this.ctx.body = 'ok!';
}
}
module.exports = HomeController;
Questions & Suggestions
Please open an issue here.