Does (or will) Meteor provide a library to handle external Web API calls? E.g. to build a Meteor app that integrates with Facebook Graph API or Google Spreadsheet API.
Meteor now includes the http package. First, run meteor add http. Then you can make HTTP requests on the server in either sync or async style:
// server sync
res = Meteor.http.get(SOME_URL);
console.log(res.statusCode, res.data);
// server async
Meteor.http.get(SOME_URL, function (err, res) {
console.log(res.statusCode, res.data);
});
Same thing works on the client, but you have to use the async form.
if (Meteor.is_server) {
var http = __meteor_bootstrap__.require("http")
// talk to external HTTP API like you would in node.js
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With