Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function (req, res, next) {
const { query } = req;
const route = omit(req.params, '__feathersId');
res.setHeader('Allow', allowedMethods.join(','));
// Check if the method exists on the service at all. Send 405 (Method not allowed) if not
if (typeof service[method] !== 'function') {
debug(`Method '${method}' not allowed on '${req.url}'`);
res.status(statusCodes.methodNotAllowed);
return next(new errors.MethodNotAllowed(`Method \`${method}\` is not supported by this endpoint.`));
}
// Grab the service parameters. Use req.feathers
// and set the query to req.query merged with req.params
const params = Object.assign({
query, route
}, req.feathers);