当我尝试使用本地主机 reactjs 提交表单时,它显示控制台错误:
“参数中缺少必需的键'TableName'”,代码:“MissingRequiredParameter”,时间:“2021-01-06T06:40:42.102Z”}。
将 AWS 放大用于前端和后端。
邮政电话是:
app.post('/contact', function(req, res) {
console.log(req);
var params = {
Tablename: process.env.STORAGE_FORMTABLE_NAME,
Item: {
id: id(),
name: req.body.name,
email: req.body.email,
phonenumber: req.body.phonenumber,
address: req.body.address,
message: req.body.message
}
}
docClient.put(params, function(err, data) {
if (err) res.json({
err
})
else res.json({
success: 'Contact created successfully!'
})
})
});