D
D
Denis11112018-08-25 22:24:55
Node.js
Denis1111, 2018-08-25 22:24:55

What is the difference between development and production environment variable? And what is it anyway?

What is the difference between development and production environment variable? And what is it anyway?
For example, this piece of code:

if (app.get('env') == 'development') {
  app.use(morgan('dev')); 
 }else {
  app.use(morgan('default')); 
}

Why are we checking for an environment variable? What's going on here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Sharapenkov, 2018-08-25
@sM0kfyz

This is a variable that specifies which version of the project you want to run.
development - for development
production - for combat conditions
And depending on this, you can connect various plugins, components, modules to make development easier (debuggers, hot reloaded, etc.) And then you can easily disable them by changing the environment variable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question