request-guardian 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/index.js +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,8 +48,4 @@ module.exports = {
|
|
|
48
48
|
} ;
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
If no validation rules are found for the current route, `request-guardian` will simply pass the request to the next middleware function in the stack.
|
|
52
|
-
|
|
53
|
-
## Keywords
|
|
54
|
-
|
|
55
|
-
express validator validation validate sanitize sanitization xss
|
|
51
|
+
If no validation rules are found for the current route, `request-guardian` will simply pass the request to the next middleware function in the stack.
|
package/index.js
CHANGED
|
@@ -24,8 +24,14 @@ function runValidator(validations) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function validate(app) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
try {
|
|
28
|
+
for (const key in require(path.resolve('utils/validations/index'))) {
|
|
29
|
+
app.use(key, runValidator(require(path.resolve('utils/validations/index'))[key]));
|
|
30
|
+
}
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error.code === 'MODULE_NOT_FOUND') {
|
|
33
|
+
console.log(`Validations rules not found at utils/validations/index.js`)
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
module.exports = validate;
|