Allow a set of HTTP methods
npm install allowed-methods> Allow a set of HTTP methods
!CI



```
$ npm install allowed-methods
`js
const http = require('http');
const allowedMethods = require('allowed-methods');
const handler = (req, res) => {
res.end('success');
};
const server = http.createServer(allowedMethods(['get', 'post'])(handler));
server.listen(3001);
`
In serverless environment:
`js
const allowedMethods = require('allowed-methods');
module.exports = allowedMethods(['get'])((req, res) => {
res.end('success');
});
`
#### methods
Type: ('get' | 'post' | 'put' | 'patch' | 'delete')[]
An array of allowed HTTP methods.
#### handler
Type: Function`
The request handler to wrap.
See the examples for more details.
- Aleksandar Stojanoski (acestojanoski)