微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ColdFusion http 请求调用 NodeJS/Express

如何解决ColdFusion http 请求调用 NodeJS/Express

我在使用 ColdFusion cfhttp 调用 NodeJS 应用程序时遇到了一个奇怪的问题。它返回状态 200 OK,但它从不调用 NodeJS 函数

NodeJS app.js

const mainRoute= require('./routes/mainRoute');

app.use('/mainRoute',mainRoute);

mainRoute.js

const myController = require('../../controllers/myController');

router.get('/abc/test',myController.getReport);

控制器:

exports.getReport = async (req,res,next) => {
   console.log('here');
}

当我使用浏览器运行它时,它工作正常并显示日志```here``

我尝试在我的 ColdFusion 应用程序中运行它:

<cfhttp result="reportURL" method="GET" charset="utf-8" url="http://localhost:3006/mainRoute/abc/test">
</cfhttp>

<cfdump var="#reportURL#" />

它返回从不显示运行 NodeJS 的应用程序中的日志 here,coldfusion dump 中的输出如下图

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。