【问题标题】:HTTP call with angular-meteor使用 angular-meteor 的 HTTP 调用
【发布时间】:2017-09-28 19:24:32
【问题描述】:

我正在尝试让HTTP.callangular-meteor 合作。

从我的 API(后端)文件夹中,我正在尝试这个方法:

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;
}

而且它总是返回false

似乎HTTP.call 总是失败,我认为这与没有import { HTTP } from 'meteor/http'; 导致我的代码崩溃有关:

找不到 npm 模块 'meteor/http'。"

我不确定我在这里做错了什么。

【问题讨论】:

    标签: angular meteor angular-meteor


    【解决方案1】:

    来自Meteor HTTP documentation

    HTTP 在客户端和服务器上提供 HTTP 请求 API。要使用这些功能,请通过在终端中运行将 HTTP 包添加到您的项目中:

    meteor add http
    

    【讨论】:

    • 谢谢,我在文档中忽略了这一点 :) 现在可以正常工作了
    猜你喜欢
    • 2016-05-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-08
    • 1970-01-01
    • 2015-02-17
    • 2023-04-05
    相关资源
    最近更新 更多