I want to launch a web server from grunt with livereload and that proxies Rest calls towards the server. Here is my Gruntfile.js :
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// 1. Toutes les configurations vont ici:
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
watch: {
all: {
files: 'webapp/*',
options: {
livereload: true,
}
},
},
express : {
all : {
options : {
bases : 'webapp',
port : 3000,
debug:true,
hostname : "0.0.0.0",
livereload : true,
middleware: function (connect, options) {
return [proxySnippet];
}
},
}
},
connect: {
proxies: [{
context: '/sis.cata/rest',
host: 'localhost',
port: 8080,
https: false,
changeOrigin: false,
xforward: false
}],
},
grunt.registerTask('develop', ['configureProxies:connect', 'express:all', 'watch' ]);};
Static files are served but calls to REST services are not proxied and blocks.
Any ideas ?
I have seen solutions with connect and proxy that works fine but never with livereload.
Thanks a lot.