Javascript 从请求中获取表单数据键值

Javascript 从请求中获取表单数据键值,javascript,node.js,rest,postman,form-data,Javascript,Node.js,Rest,Postman,Form Data,在Postman上,如果有一个POST请求,并且它被添加到Body>rawJSON文件中,则可以使用req.params.thatProperty访问代码内部 例如,我们在正文中有一个JSON: { "email": "email@test.com", "password": "secret" } 代码: app.post('/myUrl', (req, res) => { //here we can access the email by req.params.e

在Postman上,如果有一个POST请求,并且它被添加到Body>rawJSON文件中,则可以使用req.params.thatProperty访问代码内部

例如,我们在正文中有一个JSON:

{
    "email": "email@test.com",
    "password": "secret"
}
代码:

app.post('/myUrl', (req, res) => {
   //here we can access the email by req.params.email
}
我的问题是,如果像下面的屏幕截图中那样,在Body>中有表单数据,我们如何访问请求中的电子邮件?在这种情况下,没有
req.params

但是因为我正在上传一个文件并且正在使用,所以我确实可以访问
req.file
。问题是req.file中只包含与图像相关的信息,而与电子邮件无关

该函数的启动方式如下:

app.post('/upload', upload.single('value'), (req, res, next) => {
    //how can I have access to the email from the request here?
}

表单数据应在req.body中