express-verifier
body, params, query verifier middleware for express framework (nodejs)
all rules see https://www.npmjs.com/package/node-verifier
schema declaration see https://www.npmjs.com/package/node-verifier-schema
var express = ;var bodyParser = ;var verifier = ; var app = ; var verify = ; app; app;
define verifier by yaml get-user.yml:
---schema: body: first_name: - type string - min_length 3 - max_length 20 last_name: - type string - min_length 3 - max_length 20 middle_name?: - type string - min_length 3 - max_length 20 params: id: - type: string - format: ^\d+$ query: orderby?: - type: string - contains: - ASC - DESC
verifierConstructor
var verifierConstructor = ; var verifier = ;
options
options.cwd
String
- root path of yaml specs
options.preparePath( path )
function
- prepare yaml-loader path. must return path string
verifier
Set by schema. Schema must have fields "query", "params", "body", "headers"
var verifierConstructor = ;var verifier = ;var Schema = verifierConstructorSchema; var schema = object { thisobject { this; }; thisobject { ; ; };}; app;
var verifierConstructor = ;var verifier = ;var Schema = verifierConstructorSchema; var schemaParams = object { ;}; var schemaBody = object { ; ;}; app;
Add new custom rules
see https://github.com/aliaksandr-pasynkau/node-verifier for more information
var Rule = SchemaVerifierRule; var HasNotEdgeWhitespaces = Rule; Rule;