blai / grunt-express

Start an Express.js web server using grunt.js
MIT License
255 stars 41 forks source link

Is it possible to use grunt-connect-proxy with grunt-express? #50

Open mmarzec opened 10 years ago

mmarzec commented 10 years ago

I have separate backend server to provide API. I wanted to use it by setting proxy on grunt server.

My configuration is like:

    grunt.initConfig({
        watch:{
            options: {
                livereload: true
            }
        },

        express: {
          options: {
            port: 9000,
            hostname: '*'
          },
          proxies: [
            {
                context: '/_',
                host: 'localhost',
                port: 8080
            }
          ],
          livereload: {
            options: {
              livereload: true,
              bases: ['static']
            }
          }
        }

    });

grunt.registerTask('default', ['configureProxies', 'express', 'watch']);

I end up with having spawned two separate servers:

Running "configureProxies" task

Running "express:proxies" (express) task

Running "express-server:proxies" (express-server) task
Web server started on port:9000, no hostname specified [pid: 4348]

Running "express:livereload" (express) task

Running "express-server:livereload" (express-server) task
Port 9000 in use
Web server started on port:9001, no hostname specified [pid: 4348]

Running "watch" task
Waiting...
shardool commented 7 years ago

did you get anywhere with this ? Please let me know if you had any luck with this.