Skip to content
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

berman-solutions/koa-router-joi-validator

Repository files navigation

Build Status codecov npm version Known Vulnerabilities

koa-router-joi-validator

Koa Middleware for route validation using Joi with super simple JSON schemas !

Install:

npm i koa-router-joi-validator

if you are using yarn:

yarn add koa-router-joi-validator

Usage:

import { validator } from 'koa-router-joi-validator';

const usersSchema = {
    id: {
        type: 'number',
        options: { integer: true, max: 10 }
    },
    username: {
        type: 'string',
        options: { required: true }
    }
};

router.post('/users', validator(usersSchema), ctx => {
    ctx.body = 'Users route after validation!';
})

About

Koa Middleware for route validation using Joi with super simple JSON schemas !

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •