Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sailsjs: Difference between `req.body` and `req.params.all()`

What is the difference between req.body and req.params.all() when used in a sails controller?

like image 563
rjmoggach Avatar asked Feb 27 '14 17:02

rjmoggach


1 Answers

req.body is whatever was parsed out of the request body, for example the payload in a POST request. req.params.all() gives you the collection of parameters culled from (in order of precedence):

  • the route (e.g. the id in /post/:id).
  • the request body
  • the query string
like image 119
sgress454 Avatar answered Sep 30 '22 08:09

sgress454