首页 > 解决方案 > 如何在nodejs中发送变量以及重定向?

问题描述

#Following 在我的代码中进行重定向以及变量 innodejs

app.post("/newcall", function(req, res) {
  var f = (req.body.try);
  console.log("val"+ f)
  res.sendFile(path.join(__dirname, "www/newcall.html"+f))
});

变量 F 包含数据hello

但是通过这样做,我在控制台中收到了这个错误

no such file or directory, stat'c\User\Asus\Desktop\Web\www\newcall\hello

你能告诉我吗?我在这段代码中缺少什么?谢谢

标签: node.jsapiredirectnode-modulesrest

解决方案


推荐阅读