Sencha Architect Model REST代理给出错误
我有一个在端口5000上运行的本地nodejs服务器。
我使用SENCHA Architect,我想从我的Nodejs服务器加载API。
这是我的模型:
Ext.define('Hivemind.model.MyModel', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.Field',
'Ext.data.proxy.Rest'
],
fields: [
{
name: 'id'
},
{
name: 'name'
}
],
proxy: {
type: 'rest',
url: 'http://localhost:5000/getUsers'
}
});
请注意,“ http:// localhost:5000/getusers”也可以简单地通过浏览器访问,
但它给了我以下错误:
Please make sure that the URL you set for your proxy is either local, or similar to the URL you set in your projects settings.
If you plan to use a different domain, please use a JsonP proxy.
如果很重要,则项目文件夹将保存在某个地方。桌面和Nodejs服务器文件存储在其他位置
I have a local Nodejs server running on port 5000.
I use Sencha Architect and I want to load the API with the name "getUsers" from my Nodejs server.
Here's my model:
Ext.define('Hivemind.model.MyModel', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.Field',
'Ext.data.proxy.Rest'
],
fields: [
{
name: 'id'
},
{
name: 'name'
}
],
proxy: {
type: 'rest',
url: 'http://localhost:5000/getUsers'
}
});
Note that "http://localhost:5000/getUsers" is also accessible simply by the browser
But it gives me the following error:
Please make sure that the URL you set for your proxy is either local, or similar to the URL you set in your projects settings.
If you plan to use a different domain, please use a JsonP proxy.
If that matters, the project folder is saved somewhere on the Desktop, and the Nodejs Server files are stored on a different location
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需要确保在项目设置中指出的URL与代理URL字段中的内容相同。
但是,我的经验是这并不重要。该项目仍将正确构建和部署。
You just need to make sure that in the project settings the URL pointed to is the same as what's in the proxy URL field.
However, my experience is that is doesn't really matter. The project will still build and deploy properly.