javascriptnode.jsamazon-web-servicesmeteoriron-router

Using Amazon SNS with Meteor.js


I'm having trouble parsing Amazon SNS HTTP POST body data. I'm using the Iron Router plugin to run an HTTP endpoint.

The problem is Iron Router depends on the Connect npm module, which only parses requests with the following Content-Types:

application/json application/x-www-form-urlencoded multipart/form-data

Amazon SNS sends all of it's data encoded in text/plain, so custom middleware is needed to parse the body, as documented here: Handling text/plain in Express 3 (via connect)?.

How can I adapt this solution to Meteor or Iron Router?


Solution

  • If anyone is still struggling with this, it is now much easier to solve by using the following:

    onBeforeAction: Iron.Router.bodyParser.text()