sailor-validator
v1.2.2
Published
Validator for Sailor
Downloads
8
Readme
Validator for Sailor
Ensure and validate things from your request. Extend validator.js interface.
Install
npm install sailor-validator
Usage
validator = require 'sailor-validator'
or using sailor
dependency
sailor = require 'sailorjs'
validator = sailor.validator
Ideal for validate thing as pre-conditions in your request:
validator
.begin(req, res)
.add 'user', translate.get('User.NotFound'), 'notEmpty'
.end (params) ->
In this example, if user
param is empty compound a badRequest response that follow sailor-errorify
schema for errors.
For validate in the request you need to enable sailor-modulde-validator.
License
MIT © Kiko Beats