Reputation: 195
I started using gulp for my project. Earlier in the project i used grunt in which i was able to configure Ajax requests using grunt-connect-proxy.
GruntFile.js
connect: {
options: {
hostname: 'localhost',
port: 9001,
open: true,
base: ['../'],
middleware: function (connect) {
return [
proxySnippet,
connect.static('../')
];
},
livereload: true
},
proxies: [
{
context: '/data/fetch',
host: 'prt-service.test.com',
port: 8080,
https: false,
changeOrigin: true
},
{
context: '/data/report',
host: 'prt-service.test.com',
port: 8080,
https: false,
changeOrigin: true
},
{
context: '/data/group',
host: 'prt-service.test.com',
port: 8080,
https: false,
changeOrigin: true
}
],
},
I tried to do the same using gulp-connect-proxy but not able to acheive the same
GulpFile.js
connect.server({
root: "../",
port: 3000,
livereload: true,
middleware: function (connect, opt) {
opt.route = 'prt-service.test.com/data/';
var proxy = new Proxy(opt);
return [proxy];
}
});
what i am doing wrong here. could you please provide me a soltuion
Upvotes: 0
Views: 837