How to serve HTTP requests over meteor

前端 未结 3 1907
梦如初夏
梦如初夏 2021-02-10 03:42

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 me

相关标签:
3条回答
  • 2021-02-10 03:54

    This post has been updated

    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.

    0 讨论(0)
  • 2021-02-10 04:05

    Meteor Router is now deprecated for Iron Router.

    See here for Server Side Routing with Iron Router

    0 讨论(0)
  • 2021-02-10 04:14

    You directly use the underlying webapp as illustrated here or flow-router or picker for SSR routes.

    0 讨论(0)
提交回复
热议问题