https://github.com/erfanium/fastify-fv
Fastify plugin to support fastest-validator
https://github.com/erfanium/fastify-fv
Last synced: about 1 year ago
JSON representation
Fastify plugin to support fastest-validator
- Host: GitHub
- URL: https://github.com/erfanium/fastify-fv
- Owner: erfanium
- License: mit
- Created: 2020-11-08T16:24:04.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-09T18:33:47.000Z (over 5 years ago)
- Last Synced: 2025-05-08T03:17:12.208Z (about 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fastify-fv
Fastify plugin to support fastest-validator
## usage
```js
const fastify = require('fastify')
const FV = require('fastest-validator')
const fvPlugin = require('fastify-fv')
const app = fastify()
const fv = new FV()
app.register(fvPlugin, fv) // register the plugin
app.route({
method: 'POST',
url: '/a',
schema: {
body: { // fastest-validator schema
name: 'string',
age: { type: 'number', min: 18, max: 99 },
category: 'string[]',
},
},
async handler(req) {
// code
},
})
app.listen(3000)
```