Supports Fastify versions 3.x
npm i fastify-envalid
Require fastify-envalid
and register.
import fastify from 'fastify'
import fastifyEnvalid from 'fastify-envalid'
const app = fastify()
fastify.register(fastifyEnvalid)
fastify.listen(3000)
The plugin will create 3 decorators on your fastify
instance:
cleanEnv
- A function which is exactlyenvalid
cleanEnvvalidators
- An object that contains all theenvalid
validatorsmakeValidator
- A function which is exactlyenvalid
makeValidators
The code is a port for Fastify of envalid
.
Licensed under MIT.