1
votes

I want to use forever while running the express js server.Usually I used to start my server with npm start,but with forever how I can start express js server.If I am using node forever app.js command,server is not getting started.I am new to node and express.Please help me out.Thanks in advance.

After giving forever start ./bin/www command.I am getting

C:\Users\Gourab>forever start ./bin/www
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up f
or at least 1000ms
info:    Forever processing file: ./bin/www
error:   Cannot start forever
error:   script C:\Users\Gourab\bin\www does not exist.
1
in your package.json file, what is the command in the 'start' script? - war1oc
the command is "node ./bin/www" @war1oc - Gourab Sarkar
In which file and how to set spinSleepTime and minUptime ???? - Gourab Sarkar

1 Answers

2
votes
forever start ./bin/www

That is the command you need to run for you server to spin up. Your package.json file should contain:

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

You can use the following command to set the minUptime and spinSleepTime:

forever start --minUptime 1000 --spinSleepTime 1000 ./bin/www