【问题标题】:Use Google APIs Node.js client library with AppEngine Cloud Endpoints?将 Google APIs Node.js 客户端库与 AppEngine Cloud Endpoints 一起使用?
【发布时间】:2014-04-23 20:02:23
【问题描述】:

我编写了一个使用 Cloud Endpoints 的 Java App Engine 应用程序。我想从 Node.js 应用程序与这些端点交谈。是否可以为此目的使用 google-api-nodejs-client?

我已经试过了:

var googleapis = require('googleapis');

googleapis
    .discover('myapiname', 'v1dev', {baseDiscoveryUrl: 'http://localhost:8888/_ah/api/discovery/v1/apis/'})
    .execute(function(err, client) {
        console.log(err);
        console.log(client);
        client.myapiname.domains.list().execute(function(err, resp) {
            console.log(resp);
        });
    });

但是库没有发现我的端点,errclient 的回调返回 null,如下所示:

{ clients: [],
  ops: {},
  authClient: null,
  undefined: 
   { apiMeta: '<html><head><title>Error 404</title></head>\n<body><h2>Error 404</h2></body>\n</html>',
     authClient: null,
     defaultParams: null } }

我已经用“myapiname”替换了我的真实 api 名称,当然 URL http://localhost:8888/_ah/api/discovery/v1/apis/ 是可访问的(如果我在同一台计算机上的浏览器中打开它,它会返回正确的发现 JSON)。

【问题讨论】:

    标签: google-app-engine google-cloud-endpoints google-api-nodejs-client


    【解决方案1】:

    您是否尝试过在谷歌应用引擎上的某些虚拟机上部署代码的相同代码。 我对我们的应用引擎 url 进行了同样的尝试,它就像魅力一样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多