Skip to content

Commit f625e59

Browse files
Merge pull request learning-zone#12 from omarelweshy/answering-Explain-NODE_ENV
Answering NODE_ENV Question
2 parents da7378f + e3701eb commit f625e59

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,20 @@ The runtime environment is literally just the environment your application is ru
305305

306306
## Q. ***Explain usage of NODE_ENV?***
307307

308-
*ToDo*
308+
NODE_ENV is an environment variable made popular by the express web server framework. When a node application is run, it can check the value of the environment variable and do different things based on the value.
309+
310+
For example, when we work on a project and there are production and development environments. We don't need to use caching in the development env. So we set
311+
```bash
312+
$ NODE_ENV=development
313+
```
314+
315+
and use the code below
316+
```js
317+
if (process.env.NODE_ENV === 'development')
318+
useCaching = false;
319+
```
320+
Upon that, if the project runs on production it will use caching.
321+
309322

310323
<div align="right">
311324
<b><a href="#">↥ back to top</a></b>

0 commit comments

Comments
 (0)