Tim Liberty
Tim Liberty

Reputation: 2129

NODE_ENV variable in Node.js

I am a beginner in Node and I see the following code in my project:

process.env.NODE_ENV

What is NODE_ENV and how can I get access to it or change it? It seems to pick up some values but don't know from where is it getting picked up.

Please let me know.

Upvotes: 2

Views: 4630

Answers (1)

Matt
Matt

Reputation: 1038

NODE_ENV is the name of an environment variable, and you can access and change it in your shell Ex: export NODE_ENV=development , you can change it when running your process, Ex: NODE_ENV=production node application.js, or you can change it in one of your shell's configuration files.

Upvotes: 4

Related Questions