Reputation: 14846
I have a Meteor app that currently polls another app for updates. I would like to stop the inefficient polling and have the other app just POST data to the meteor app when it's ready. How can I receive POST data in my meteor app?
Upvotes: 2
Views: 774
Reputation: 8413
You can use the built in webapp package to receive and respond HTTP requests on the server side. It works without any additional packages (such as iron router, flow router etc.).
Upvotes: 2
Reputation: 456
If you are using Iron Router, you can setup a server route to handle the request:
if (Meteor.isServer) {
Router.map(function () {
this.route('serverRoute', {
where: 'server',
path: '/server',
action: function() {
if (this.request.method === 'POST')
this.response.end("handling post request");
}
});
});
}
Upvotes: 2