Code Diary
Code Diary

Reputation: 427

Forever with npm start and environment variable

I used to start my application using:

DEBUG=chakka ENVIRONMENT=production npm start

How can i start it using forever so i wouldn't have to do it everytime i want to test the application? Thanks!

Upvotes: 3

Views: 7157

Answers (1)

Daniel
Daniel

Reputation: 38761

First you need to know what the application's main script file is. Open up your package.json file and find out what the start script is. If you're using Express it might be app.js. So we'll assume app.js for this example, replace with whatever your file is.

To start the application:

DEBUG=chakka ENVIRONMENT=production forever start app.js

to restart the application after you've made changes:

forever restart app.js

Upvotes: 4

Related Questions