express.js - req.body? [英] express.js - req.body?

查看:160
本文介绍了express.js - req.body?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是js的新人,
我在阅读的代码中看到了很多

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

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

req.body做什么?
我什么时候可以说req.body.something?

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

推荐答案

req.body 保存作为POST请求的一部分从客户端发送的参数。请参阅 API

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"

这篇关于express.js - req.body?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆