I am finding myself pretty stuck using grunt-connect-proxy to make calls from my yeoman generated angular app running on port 9000 to my laravel backend which is running on port 8000. After following the instructions on the grunt-connect-proxy github I see the following message upon running grunt serve:
Running "configureProxies:server" (configureProxies) task
Proxy created for: /api to localhost:8000
I have my proxies set up here in connect.proxies directly following connect.options:
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
}],
In my controller then attempt to make a call to the api to test my proxy:
var Proxy = $resource('/api/v1/purchase');
Proxy.get(function(test){
console.log(test);
});
In the result of this in my console is a 500 error indicating that the call was still made to port 9000 rather than 8000:
http://localhost:9000/api/v1/purchase 500 (Internal Server Error)
Here is a link to a gist containing my full gruntfile: https://gist.github.com/JohnBueno/7d48027f739cc91e0b79
I have seen quite a few posts on this but so far none of them have been of much help to me.