request-guardian 1.0.17 → 1.0.18
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 +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,12 +18,17 @@ yarn add request-guardian
|
|
|
18
18
|
|
|
19
19
|
`request-guardian` is a middleware function that can be used with `Express` applications. To use it, simply require the module and use it as middleware for your routes.
|
|
20
20
|
|
|
21
|
+
NOTE: Make sure that you call the validate() method after a middleware to parse incoming requests with JSON payloads.
|
|
22
|
+
|
|
21
23
|
```javascript
|
|
22
24
|
const express = require('express');
|
|
23
25
|
const validate = require('request-guardian');
|
|
24
26
|
|
|
25
27
|
const app = express();
|
|
26
28
|
|
|
29
|
+
// middleware to parse incoming requests with JSON payloads.
|
|
30
|
+
app.use(express.json());
|
|
31
|
+
|
|
27
32
|
// Use Request Guardian middleware
|
|
28
33
|
validate(app);
|
|
29
34
|
|