【发布时间】:2021-11-17 16:03:44
【问题描述】:
我想在 res.send(data) 中发送数据。当我
console.log("This dox data",text);
在终端中,它工作正常。它记录终端中的所有文本内容。但是在前端访问它会给我错误
router.get("/api/emailtemplates/data/:subject", (req, res) => {
Email_templates.find({subject: req.params.subject}, (err, data) => {
if (!err) {
const val = data[0]['template_file_link'];
console.log(val);
const data= textract.fromFileWithPath(val, function( error, text ) {
console.log("This dox data",text);
});
res.send(data);
} else {
console.log(err);
}
});
【问题讨论】:
-
什么错误,你怎么称呼它
-
@achyuta - 你遇到了什么错误?
-
App.js const onsubjectChange = (value,e)=>{setLink(e.label); setChooseSubject(value);console.log("this is subject",value)} Service.js export const getEmailTemplateSub = (state="")=>{ Axios.get(
http://localhost:3002/api/emailtemplates/data).then(res => state( res.data) ).catch(err=>console.log(err)) }; -
while我在前端选择主题我得到一个错误 events.js:292 throw er; // 未处理的“错误”事件类型错误:无法读取未定义的属性“模板文件链接”
-
更新问题而不是在 cmets 中发布代码
标签: javascript node.js reactjs