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: 4 months 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 (5 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
[](https://travis-ci.org/berman-solutions/koa-router-joi-validator)
[](https://codecov.io/gh/berman-solutions/koa-router-joi-validator)
[](https://badge.fury.io/js/koa-router-joi-validator)
[](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!';
})
```