grunt-connect-proxy を使用して、ポート 9000 で実行されている yeoman で生成された angular アプリから、ポート 8000 で実行されている laravel バックエンドへの呼び出しを行うのにかなり行き詰っています。 grunt-connect-proxy github の指示に従った後、 grunt serve を実行すると、次のメッセージが表示されます。
Running "configureProxies:server" (configureProxies) task
Proxy created for: /api to localhost:8000
ここで、connect.options の直後の connect.proxies にプロキシを設定しました。
proxies: [{
context: '/api', // the context of the data service
host: 'localhost', // wherever the data service is running
port: 8000 // the port that the data service is running on
}],
次に、コントローラーで API を呼び出してプロキシをテストします。
var Proxy = $resource('/api/v1/purchase');
Proxy.get(function(test){
console.log(test);
});
この結果、コンソールに 500 エラーが表示され、8000 ではなくポート 9000 に対して呼び出しが行われたことを示します。
http://localhost:9000/api/v1/purchase 500 (Internal Server Error)
ここに私の完全な gruntfile を含む要点へのリンクがあります: https://gist.github.com/JohnBueno/7d48027f739cc91e0b79
これに関するかなりの数の投稿を見てきましたが、これまでのところ、どれもあまり役に立ちませんでした.