0

我编写了一个使用 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);
        });
    });

但是库没有发现我的端点,回调返回 nullerr并且client看起来像这样:

{ 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 名称,当然 URLhttp://localhost:8888/_ah/api/discovery/v1/apis/是可访问的(如果我在同一台计算机上的浏览器中打开它,它会返回正确的发现 JSON)。

4

1 回答 1

0

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

于 2014-07-09T18:06:34.393 回答