Meteor.js - 我如何从其他网络应用程序接收POST数据?

时间:2014-07-21 21:53:24

标签: meteor http-post

我有一个Meteor应用程序,目前轮询另一个应用程序以获取更新。我想停止低效率的轮询,并让其他应用程序在准备就绪时将数据发布到流星应用程序。如何在流星应用程序中接收POST数据?

2 个答案:

答案 0 :(得分:2)

如果您使用的是Iron Router,则可以设置server route来处理请求:

if (Meteor.isServer) {
  Router.map(function () {
    this.route('serverRoute', {
      where: 'server',
      path: '/server',
      action: function() {
        if (this.request.method === 'POST')
          this.response.end("handling post request");
      }
    });
  });
}

答案 1 :(得分:2)

您可以使用内置的webapp package在服务器端接收和响应HTTP请求。它没有任何额外的包(如铁路由器,流路由器等)。

相关问题