[SOLVED] How can i receive post data from another web app


#1

Hi everybody,

I’m trying to receive post data from another web app which is using php and it’s submiting a HTTP POST

<form action="http://my_app/pay/notify" method="post">
      <input type="text" name="merchant_oid" value="sdasdasdads">
      <input type="submit">
</form>

And i want to read name="merchant_oid" in my method in meteor app. I tried

`Template.payNotify.helpers({
‘status’: function() {
return Meteor.call(‘notifyPay’);
}
});

‘notifyPay’: function() {
console.log(‘Notification has started by the request’);

var bodyParser = Npm.require('body-parser'); 
Picker.middleware(bodyParser.urlencoded({ extended: false }));
Picker.middleware(bodyParser.json());

var post = Picker.filter(function(req, res) {
  return req.method == "POST";
});

post.route('/post', function(params, req, res, next) {
  console.log(params);   
  console.log(req.data); 
  console.log(req.body); 
  res.end();
});

But, i got

Exception while invoking method 'notifyPay' TypeError: POST.hasOwnProperty is not a function

Is there an easy way to do it? Thanks.


#2

I changed post.route('/pay/notify',