【发布时间】:2022-12-21 07:12:45
【问题描述】:
我有一个在端口 5000 上运行的本地 Nodejs 服务器。
我使用 Sencha Architect,我想从我的 Nodejs 服务器加载名为“getUsers”的 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 服务器文件存储在不同的位置
【问题讨论】:
标签: node.js rest extjs proxy architect