0.0.1 • Published 4 years ago

@kemuscorp/schema-validator v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@kemuscorp/schema-validator

This library is on Beta. A validation middleware of schema for routing on express. This library uses Joi to validate schemas. Please do not use it on production.

How to install it

$ npm install @kemuscorp/schema-validator

How to use it

const express = require('express')
const validate = require('@kemuscorp/schema-validator')

const Router = express.Router()
const schema = require('path-to-your-schema')

Router.post('/admin', validate(schema, 'params'), (req, res, next) => {
  // your code
})

Take in mind you need to declare your schema with your properties using Joi. In LTS releases, you will be able to create schemas using this module.