You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recommend always using this middleware globally with app.use as a first middleware in your app. This is because, if a bad actor is making requests to your app to find attack vectors, you throw their request out as early as possible.
30
+
31
+
Route-specific blocking of methods is an additional layer of protection you can explore. It may be that your app does support POST requests for a form but the main view is GET only. You can filter out further junk requests on a per-route basis by using the app.route('...').all() method or use with a path.
app.listen(3000, () =>console.log('Server running on port 3000'));
@@ -69,32 +81,10 @@ An array of HTTP methods that are allowed for the route. This must be an `Array`
69
81
70
82
This option defaults to `[]`.
71
83
72
-
#### `options.message`
73
-
74
-
A string to be used as the response body when a request is made with an unsupported method.
75
-
76
-
This option defaults to `'Method Not Allowed'`.
77
-
78
-
#### `options.logger`
79
-
80
-
A logger object which implements two methods, `error` and `warn`, which have the following permissive signature:
81
-
82
-
```ts
83
-
typeLogMethod= (...logData:any) =>any;
84
-
```
85
-
86
-
This is passed directly onto the relevant log-error method, [see the documentation for that package for more details](../log-error/README.md#optionslogger).
87
-
88
-
## Migrating
89
-
90
-
Consult the [Migration Guide](./docs/migration.md) if you're trying to migrate to a later major version of this package.
91
-
92
-
93
84
## Contributing
94
85
95
86
See the [central contributing guide for Reliability Kit](https://github.com/Financial-Times/dotcom-reliability-kit/blob/main/docs/contributing.md).
96
87
97
-
98
88
## License
99
89
100
90
Licensed under the [MIT](https://github.com/Financial-Times/dotcom-reliability-kit/blob/main/LICENSE) license.<br/>
0 commit comments