I am facing issue while communicating between gulp-connect and gulp-stubby-server.
gulp-connect is running on port 3006 and stubby is running on port 8000 but somehow it's trying to connect to stubby on port 3006 only and I am getting 404 error. I have done proxy middleware configuration to redirect all request of path /my-server to stubby server but it seems to not working. What am I missing here?
angular.js:12185 POST http://localhost:3006/my-server/services/getTestData 404 (Not Found)
var configuration = {
    myProxy: _.extend(url.parse('http://localhost:8000/my-server/'), {route: '/my-server'})
}
gulp.task('static', function () {
    connect.server({
        root: ['target'],
        port: 3006,
        livereload: false,
        middleware: function () {
            return [
                proxy(configuration.myProxy)
            ];
        }
    });
});
gulp.task('stubby', function (cb) {
    var options = {
        files: [
            'mocks/test/*.{json,yaml,js}'
        ],
        callback: function (server, options) {
            server.get(1, function (err, endpoint) {
                if (!err) {
                    console.log(endpoint);
                }
            });
        },
        stubs: 8000,
        tls: 8443,
        admin: 8010
    };
    stubby(options, cb);
});
sample mock.json
{
  "request" : {
    "url": "^/my-server/services/getTestData$",
    "method": "GET"
  },
  "response":{
    "status" : 200,
    "headers" :{
      "Content-Type" : "application/json"
    },
    "latency" : 1000,
    "body" : "Some Test Data"
  }
}
resource
var testResource = function($resource , CONS){
    console.log('test resource');
    var requestURL = '/my-server/services/getTestData';
    return $resource(requestURL , {},{
        getTestData: {
            method: 'POST'
        }
    });
};
				
                        
Look at the error log you posted:
That's a
POSTrequest, but you've only mockedGETrequests in your mock.json file. You need to allow for bothPOSTandGETrequests: