【发布时间】:2021-10-18 17:00:02
【问题描述】:
app.post('/hide_feed', middleware.authenticateToken, (req, res, next) => {
if (req.body.followered_to_id) {
return res.status(400).json({
status: 400,
msg: req.body.followered_to_id
});
}
});
尝试添加
app.use(express.urlencoded({
extended: false // also true
}));
仍然无法获取body表单数据
【问题讨论】:
-
发送 JSON 数据或普通文本的 urlencoded 和图像或文件的 formData