express.js - req.body?


Question

I'm new to js, I see this a lot in the code I'm reading

_.pick(req.body, ' ' , ' ') 

What does req.body do? And when can I say req.body.something?

1
8
12/23/2012 4:51:41 AM

req.body holds parameters that are sent up from the client as part of a POST request. See the API.

// POST user[name]=tobi&user[email]=tobi@learnboost.com
req.body.user.name
// => "tobi"

req.body.user.email
// => "tobi@learnboost.com"

// POST { "name": "tobi" }
req.body.name
// => "tobi"
28
12/24/2012 6:09:56 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon