Server Side Meteor ajax

I am trying to access the remote server API and must make an ajax call. It is best if this is done on the server side so as not to violate the API keys. How can I do this with a meteor?

+4
source share
2 answers

If this is a leisure API, you probably want to use Meteor.http.post (docs here ). Sort of:

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

It also works on the client side.

+2
source

The current method seems to be via the http package.

First add it to your project as follows: meteor add http . Then you can use it as follows:

 var result = HTTP.call("GET", "http://api.twitter.com/xyz", {params: {user: userId}}); 
+3
source

All Articles