-1
我想发送数据到在tomcat server.this上运行的java后端,这是我迄今试过的。我已经安装了请求module.get方法是好好工作。POST请求无法使用node.js中的请求模块工作
Router.post('/', function(req, res) {
request({
uri: "http://localhost:8080/HIS_API/rest/UserService/registerUser",
method: "POST",
form: {
roleId:2,
employeeId:26,
userName:"testing",
password:"123"
}
}, function(error, response, body) {
console.log(body);
});
});
那到底究竟是不是工作?你有错误吗?也许服务器期望除了'application/x-www-form-urlencoded'之外的东西? – robertklep