by funthree · 14y ago · 0 comments
For instance you might have a .production file
export NODE_ENV="production"
export NODE_PORT="80"
And a .development file export NODE_ENV="development"
export NODE_PORT="3000"
Before you run "node app" just link to your variables with "$ . .production" or "$ sh .production"Again there are many ways to accomplish this same thing but this way is pretty straightforward if you are familiar with linux.
EDIT: To add to the link to configuration pkrumins posted (http://expressjs.com/guide.html#configuration)
process.env will hold all of your environment variables, and express.js will read "NODE_ENV" internally. A combination of the above, and setting up corresponding internal configuration in your node.js app will provide for a very clean setup.
No comments yet.