Sencha Architect Model REST代理给出错误

发布于 2025-01-29 10:05:35 字数 855 浏览 4 评论 0原文

我有一个在端口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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉徒眸意 2025-02-05 10:05:35

您只需要确保在项目设置中指出的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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文