如何通过流星提供HTTP请求 [英] How to serve HTTP requests over meteor

查看:176
本文介绍了如何通过流星提供HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用meteor创建一个实时流媒体应用程序。目前我需要创建一个实时转码选项,因此我尝试将此node.js模块与我们的流星应用程序集成: https: //github.com/mifi/hls-vod 。但是,它的工作方式是你实际从HTML5视频标签的src中调用app.get(hls /)。我想知道是否有办法期望使用流星调用此方法。由于我无法将表达与流星整合,因此我遇到了一些麻烦。我想知道是否有办法让流星接收HTTP请求并根据节点模块发回数据。

I am creating a live streaming application using meteor. Currently I have a need to create a live transcoding option, so I am trying to integrate this node.js module with our meteor application: https://github.com/mifi/hls-vod. However, the way it works is that you actually call the app.get(hls/) from your HTML5 video tag's src. I am wondering if there is a way to expect the call to this get using meteor. Since I can't integrate express with meteor I am having some trouble doing this. I am wondering if there is a way to have meteor receive HTTP requests and send back data as per the node module.

推荐答案

这帖子已更新

要通过meteor服务http请求,您需要一个路由器。我会推荐ironRouter。有流星路由器,但Tom Coleman也建造了ironRouter。

To server http requests over meteor you need a router. I would recommend ironRouter. There was meteor router but Tom Coleman also built ironRouter.

你可以使用这样的东西:

You can use something like this:

Router.map(function () {


this.route('serverFile', {
    path: '/pathonserver',

    action: function () {
      console.log(this.params); //Contains params

      this.response.writeHead(200, {'Content-Type': 'text/html'});
      this.response.end('hello from server');
    }
  });
});

希望这条路线能够像快递路由器一样工作。

Hopefully that should get the route working similar to the express router.

这篇关于如何通过流星提供HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆