Deploy node app with http-server and forever

surganov picture surganov · Oct 20, 2014 · Viewed 7.9k times · Source

I want to use http-server and forever.js to deploy my app to remote ubuntu server. But forever.js requires path to JS file, not to executable. So I can't pass keys to http-server. Best solution so far is to install http-server locally via npm and run something like this: forever start ./node_modules/http-server/bin/http-server. But in this case I can't set port and other options. What's the best practice?

Answer

jsejcksn picture jsejcksn · Dec 16, 2014

You can set the options using that code. Just use the available flags after the end of your command. For example:

forever start ./node_modules/http-server/bin/http-server -p 80 -d false