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?
2 Answers
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.).
Comments
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");
}
});
});
}