Let’s say I have a Meteor server running on a computer. If I had another computer trying to send a request to the server, I would do something like http://meteor.server.local/some-action?id=xyz&data=123
a computer -> (get or post) -> the Meteor server
Is there a way to receive requests on the server side?
Quick word of warning about the original Picker package - it hasn’t been updated in quite some time, and is incompatible with some of the recent Meteor core WebApp changes. For example, it breaks dynamic imports. You might be better off finding a more up to date fork of Picker, or skipping Picker completely, and just integrating with Meteor’s connect middleware layer directly. Meteor makes this quite easy:
Both approaches work well. Using router will save you from some additional boilerplate, but you’ll be adding in another dependency. Always a trade-off, and there isn’t really a single right answer - they’ll both get the job done.
Hi there, I’ve tried pigel approach on my recently updated app without success when using mailgun routes for incoming messages (store and notify). I used to go with Picker to get the notification of a new message from mailgun, but then I had the already reported error. Then I tried a fresh meteor create app, pasted the suggested code in sever/main (tried with both versions), added the npm dependencies (body-parser and router) and both console.logs show an empty object, ie req.query = {} and req.body = {}. Tested using the “Send Sample POST” in the routes section of Mailgun’s dashboard. I get the request object (console.log(req) yields a bunch of stuff) but without the body key
Any suggestion would be really appreciated
Sorry for the confusion guys. I guess that Mailgun’s “send Sample POST” doesn’t send a body and just cheks if a 200 code is returned. The fact is that testing with a real reply message does work, but only using the route approach. The other method still returns an empty body