Forever Node.JS Express 4

Eric Sheasby picture Eric Sheasby · Jun 6, 2014 · Viewed 18.6k times · Source

How do you run the Express 4 app with Forever? (or is there a new package?)

I am running my Express 3 apps with Forever installed locally with the package manager. I use the command:

forever -a start app.js

Answer

Ryan picture Ryan · Jul 23, 2014

Try this:

forever start ./bin/www

Let's take a look to package.json:

"scripts": {
    "start": "node ./bin/www"
},

I guess when we call npm start, ./bin/www will be executed at some point. Then look at the content of./bin/www:

var server = app.listen(app.get('port'), function() {
  debug('Express server listening on port ' + server.address().port);
});

so we are ready to listen for connections.