I've coded an Java App Engine app that uses Cloud Endpoints. I want to talk to these endpoints from a Node.js app. Is it possible to use the google-api-nodejs-client for this purpose?
I've already tried this:
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);
});
});
But the library does not discover my endpoint, the callback returns null for err
and client
looks like this:
{ 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 } }
I've replaced my real api name with 'myapiname' and of course the URL http://localhost:8888/_ah/api/discovery/v1/apis/
is reachable (it returns me the right discovery JSON if I open it in the browser on the same computer).