0.0.9 • Published 5 years ago

routevalidator v0.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Route validator

Express js Middleware which only allows configured urls and params to pass through and validates authentication otherwise throws error

Usage

  1. Session validation - require("routevalidator").sessionValidation({func(req)}) - pass a function to validate authentication to your app. When authentication is set as true in rule, this function will be invoked. express request object will be passed as a param, must return true or false
  2. URL validation - require("routevalidator").initRules({securityRulesObj}) - pass Security Rule object (refer doc below)
  3. Add to express router.use(require("routevalidator").routeValidator) - pass require("routevalidator").routeValidator to express js router as a middleware

Security Rules

"<url_pattern>": { authentication: true|false, methods: { POST: { params: { userName: { regex:"[a-z]+", minLength:8, maxLength:100, mandatory:true }, password: { maxLength:100, mandatory:true }, serurl: { minLength:1, maxLength:100, }, displayName:{ regex:"[a-zA-z]+", minLength:1, maxLength:100, mandatory:true } } } } }

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago