Skip to content

alemagio/fastify-envalid

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

fastify-envalid

js-standard-style CI workflow

Supports Fastify versions 3.x

Install

npm i fastify-envalid

Usage

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 exactly envalid cleanEnv
  • validators - An object that contains all the envalid validators
  • makeValidator - A function which is exactly envalid makeValidators

Acknowledgements

The code is a port for Fastify of envalid.

License

Licensed under MIT.