Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/berman-solutions/koa-router-joi-validator
Koa Middleware for route validation using Joi with super simple JSON schemas !
https://github.com/berman-solutions/koa-router-joi-validator
Last synced: 9 days ago
JSON representation
Koa Middleware for route validation using Joi with super simple JSON schemas !
- Host: GitHub
- URL: https://github.com/berman-solutions/koa-router-joi-validator
- Owner: berman-solutions
- Archived: true
- Created: 2017-07-12T16:52:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-13T17:13:41.000Z (over 2 years ago)
- Last Synced: 2024-09-19T16:15:39.299Z (about 2 months ago)
- Language: TypeScript
- Homepage: https://npmjs.com/package/koa-router-joi-validator
- Size: 85.9 KB
- Stars: 17
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/berman-solutions/koa-router-joi-validator.svg?branch=master)](https://travis-ci.org/berman-solutions/koa-router-joi-validator)
[![codecov](https://codecov.io/gh/berman-solutions/koa-router-joi-validator/branch/master/graph/badge.svg)](https://codecov.io/gh/berman-solutions/koa-router-joi-validator)
[![npm version](https://badge.fury.io/js/koa-router-joi-validator.svg)](https://badge.fury.io/js/koa-router-joi-validator)
[![Known Vulnerabilities](https://snyk.io/test/github/berman-solutions/koa-router-joi-validator/badge.svg)](https://snyk.io/test/github/berman-solutions/koa-router-joi-validator)# 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:
```javascript
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!';
})
```