Sunday, January 31, 2021

Why should set NODE_ENV variable to production

 A common convention in Node.js is that the NODE_ENV environment variable specifies the environment in which an application is running (usually, development or production).


For example, with express, setting NODE_ENV to “production” can improve performance by a factor of 3 according to the documentation. This enables:


Cache for view templates.

Cache for CSS files generated from CSS extensions.

Generate less verbose error messages.


references:

https://pm2.io/docs/runtime/best-practices/environment-variables/


No comments:

Post a Comment