[英]How to access Google Cloud Endpoints on non-default module of local Google App Engine?
I'm developing a Google App Engine app with several modules. 我正在开发一个包含多个模块的Google App Engine应用程序。 Back-end APIs utilize Google Cloud Endpoints.
后端API使用Google Cloud Endpoints。 When I run the GAE server locally even though I load the APIs from my admin module (localhost:9090) after the client is loaded it tries to make the calls to the default module port (localhost:8080).
当我在本地运行GAE服务器时,即使我在加载客户端后从我的管理模块(localhost:9090)加载API,它也会尝试调用默认模块端口(localhost:8080)。 On remote GAE instance everything works just fine.
在远程GAE实例上一切正常。 What can be the reason or workaround for that?
可能是什么原因或解决方法?
The code is: 代码是:
function init() {
var loadCallback = function () {
gapi.client.adminapi.mymethod(12345).then(alert(Woohoo!));
};
var apiRoot = '//' + window.location.host + '/_ah/api';
gapi.client.load('adminapi', 'v1', loadCallback, apiRoot);
}
Okay, the only answer that I've found and that worked as a workaround for non-default module in local GAE was described here: https://code.google.com/p/google-api-javascript-client/issues/detail?id=147 好的,我找到的唯一答案是本地GAE中非默认模块的解决方法: https : //code.google.com/p/google-api-javascript-client/issues/细节?ID = 147
Alternative: Add to @Api annotated Java class: root = " http://localhost:8090/_ah/api
", backendRoot = " http://localhost:8090/_ah/spi
", 替代方案:添加到@Api带注释的Java类:root =“
http://localhost:8090/_ah/api
”,backendRoot =“ http://localhost:8090/_ah/spi
”,
The only moment in these 2 approaches: I should not commit these changes as these URLs are surely not meant for production. 这两种方法中唯一的一刻:我不应该提交这些更改,因为这些URL肯定不适合生产。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.