使用Iron Router从Ruby发布到Meteor?

我一直在尝试从Ruby脚本获取消息到使用POST使用MeteorJS构建的webapp,但我一直面临一些问题。 关于使用Iron Router进行POST和GET方法管理的在线文档并不多。

我的Ruby脚本:

meteorUri = URI('http://localhost:3000/newReport'); res = Net::HTTP.post_form(meteorUri, 'message' => 'HelloFromRuby', 'max' => '50') puts "From Meteor:\t#{res}" 

我对Ruby没有多少经验。 我上面的代码大部分是在线的。

使用铁路由器的路由:

  Router.route('/newReport/:message', {where: 'server'}) .post( function(message){ Meteor.call('reportInsert', {message: message}, function(error, recordId){ if (error){ alert(error.reason); } else { console.log("Inserted " + recordId); } }); }); 

我试图让Ruby发一个post到http://localhost:3000/newReport并带有一个应该是字符串的消息。

函数reportInsert工作,我测试了它。 问题似乎在于发布POST或接收它。

谢谢!

除了在服务器端路由中使用警报外,我在Meteor方面没有看到任何问题。 可能想将其更改为console.log以查看您获得的错误。