params-validate-feng

0.0.3 • Public • Published

Introduction

params validate middleware of koa base on joi

Usage

npm install --save params-validate-feng

const app=require('koa')();
const match=require('url-match-feng');
const validate=require('params-validate-feng');
const Joi =require('joi');
const schema=Joi.object().keys({
    id:Joi.string().required()
});
const routesconfig={
     '/index': { method: 'GET', cache: 300, main: 'index', type: 'html',schema:schema },
    '/channel': { method: 'GET', cache: 200, main: 'channel', type: 'html' },
};
app.use(match({routesConfig}));
app.use(validate());

app.listen(3000);

options

Readme

Keywords

Package Sidebar

Install

npm i params-validate-feng

Weekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • jerryshan