req.allParams()

Returns the value of all parameters sent in the request, merged together into a single object. Includes parameters parsed from the url path, the query string, and the request body. See req.param() for details.

Usage

req.allParams();

Example

Update the product with the specified sku, setting new values using the parameters which were passed in:

var values = req.allParams();

// Don't allow `price` or `isAvailable` to be edited.
delete values.price;
delete values.isAvailable;

// At this point, `values` might look something like this:
// values ==> { displayName: 'Bubble Trouble Bubble Bath' }

Product.update({sku: sku})
.set(values)
.then(function (newProduct) {
  // ...
});

Notes

  • This method can also be called as req.params.all() - they are synonyms.