ember-cli --proxy works for GET but fails on PUT and POST

我只是一个虾纸丫 提交于 2019-12-18 20:08:10

问题


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.

I'm starting the server to proxy to localhost:3000

ember serve --proxy http://localhost:3000/

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/posts 408 (Request Time-out)

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?

I'm using ember-cli 0.28, ember 1.5.1, ember-data 1.0.0-beta.7, and rails 4.1.


回答1:


The solution was to comment out app.use(bodyParser()); in server/index.js



来源:https://stackoverflow.com/questions/23856465/ember-cli-proxy-works-for-get-but-fails-on-put-and-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!