Meteor server side ajax

ajax, meteor

Solution

If it's a rest API, you probably want to use `Meteor.http.post` (docs here). Something like:

Meteor.http.post(API_URL, {foo: 'bar', other: 'data'}, function(err, result) {
  if (!err)
    // do something with the result.
});

This works client side too.

Problem

I'm trying to access a remote server API and need to make an ajax call. It's best if it's done from the server side so as not to compromise the API keys. How would I do this with meteor?

Original source