angularmeteorangular-meteor

HTTP call with angular-meteor


I'm trying to get HTTP.call work with angular-meteor.

From my API (backend) folder, I'm trying this in a method:

this.unblock();
try {
  const result = HTTP.call('GET', 'https://api.foursquare.com/v2/users/self?oauth_token=RHFPPND0TSNNC0FUADM2FO3CVTRX3T1KS1IKC2245YRENYYS&v=20170928');
  return result;
} catch (e) {
  return false;
}

And it always returns false.

It seems that the HTTP.call always fails, and I assume this is to do with not having import { HTTP } from 'meteor/http'; which causes my code to crash with:

Can't find npm module 'meteor/http'."

I'm not sure what I'm doing wrong here.


Solution

  • From the Meteor HTTP documentation:

    HTTP provides an HTTP request API on the client and server. To use these functions, add the HTTP package to your project by running in your terminal:

    meteor add http