View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

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.

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book