ericclemmons / grunt-express-server

Grunt task for running an Express Server that works great with LiveReload + Watch/Regarde
MIT License
248 stars 64 forks source link

configure debug port? #71

Closed matyus closed 10 years ago

matyus commented 10 years ago

I am in a situation where I'm running two separate servers on my computer and they both want to use the same port (but can't) so I was hoping to change it for one of them... However, the only solution I've found it outside the scope of the gruntfile configuration, something like node --debug=7000 app.js (ie. http://stackoverflow.com/a/18911247).

Am I just missing something obvious, or is it possible to alter the default debug port from 5858 in the gruntfile?

ericclemmons commented 10 years ago

You should be able to use the usual:

$ PORT=5858 grunt

as you would:

$ PORT=5858 node app.js

Alternatively, you can specify the port option as well.

Since it sounds like you have a single entry-point that starts up two servers, my preferred approach is having the primary use the default or specified PORT variable (usually 3000) while the other uses (process.env.PORT || 3000) + 1.

ericclemmons commented 10 years ago

Ah, I see now. (Didn't click the link the 1st time). As mentioned via the README, you should be able to add additional opts for the node command: opts: ['--debug=5858'].

matyus commented 10 years ago

@ericclemmons adding the flag to the opts array certainly works. thank you!