Accept post request with iron router

I am trying to accept a post request from my twilio account to my application in order to receive an xml response. How can I answer an incoming mail request in an iron router? I read the docs and tried everything, but I just got (Error: Not implemented on server yet). I tried to put it on server, client and lib .:

Router (lib / router.coffee)

Router.route('/api/twilio/voice', where: 'server')
  .post -> console.log 'hey'

      

+3


source to share


1 answer


This is because it is this.subscribe

then .wait()

configured for both server and client. Search .wait

within the framework Router

and make sure it only works with the client .

Look at the part of the code where this happens in the repo iron-controller

:

https://github.com/EventedMind/iron-controller/blob/devel/lib/controller_server.js

Also I think the best way to debug (instead of console.log

) is to actually use this.response

:



    Router.route('/api/twilio/voice', { where: server })
      .post(function() {
        this.response.end('hey');
    });

      

or even the classic format:

    Router.route('/api/twilio/voice', { where: server })
      .post(function(req, res, next) {
        res.end('hey');
    });

      

Edit: The issue was sent here and PR here .

+3


source







All Articles