ember-cli --proxy适用于GET,但在PUT和POST上失败 [英] ember-cli --proxy works for GET but fails on PUT and POST
问题描述
我正在尝试将我的应用程序从Ember Appkit移动到ember-cli,我无法复制以前由APIMethod和proxyURL方法提供的代理功能。
I'm trying to move my application from Ember Appkit to ember-cli and I'm having trouble replicating the proxy functionality previously provided by the APIMethod and proxyURL methods.
我正在启动服务器代理到localhost:3000
I'm starting the server to proxy to localhost:3000
ember serve --proxy http:// localhost:3000 / code>
ember serve --proxy http://localhost:3000/
这将正确地从rails服务器读取我的数据。但是,当我尝试写入服务器时,我会收到一条错误消息。
This will read my data from the rails server correctly. However, when I try to write to the server, I get an error message
POST http:// localhost:4200 / api / v1 /帖子408(请求超时)
它正在尝试发布到端口4200,这是ember应用程序正在服务的地方,但我我希望它发布到3000端口。我如何得到它?
It's trying to post to port 4200, which is where the ember app is being served, but I want it to post to port 3000. How can I get it to do so?
我使用ember-cli 0.28,ember 1.5.1,ember-data 1.0 .0-beta.7和rails 4.1。
I'm using ember-cli 0.28, ember 1.5.1, ember-data 1.0.0-beta.7, and rails 4.1.
推荐答案
解决方案是注释掉应用程序。在server / index.js中使用(bodyParser());
这篇关于ember-cli --proxy适用于GET,但在PUT和POST上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!