Express JSON Validator
This project is a simple and application forward express.js validation middleware generator that uses JSON Schemas as the source of configuration.
WHY: basically, i want the point and shoot type of development experience. plus consistency of the error messages and ease of custom integrations.
Installation & Usage
npm install express-json-validator --save
const express = ;const validate ValidationError = ;const schema = properties: username: type: 'string' password: type: 'string' required: 'username' 'password' ; const app = ; app; // HOORAY consistent errors handling!app;
Data Envelopes Support
If you're using rails-ish data envelopes for your params, meaning, user[username]
and user[password]
instead of plain username
and password
. This package
allows you to specify the envelope
option.
app { const user: username password = reqbody; User;});
Copyright & License
All code in this repository is released under the terms of the ISC license.
Copyright (C) 2016 Nikolay Nemshilov