0.0.5 • Published 5 years ago

@koex/joi v0.0.5

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

joi

NPM version Coverage Status Dependencies Build Status license issues

joi for koa extend.

Install

$ npm install @koex/joi

Usage

// See more in test
import * as bodyParser from 'koa-body';
import onerror from '@zcorky/onerror';
import joi from '@koex/joi';
import * as router from '@koex/router';

import * as Koa from 'koa';
const app = new Koa();

app.use(onerror());
app.use(bodyParse());
app.use(joi());

app.use(router.post('/', (ctx, next) => {
  const data = await ctx.validate({
    name: 'string',
    age: 'int',
  });

  ctx.body = data;
}));

app.listen(8000, '0.0.0.0', () => {
  console.log('koa server start at port: 8000');
});

Related

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago