Book Image

Node Cookbook: Second Edition

By : David Mark Clements
Book Image

Node Cookbook: Second Edition

By: David Mark Clements

Overview of this book

Table of Contents (18 chapters)
Node Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing server tier environments


An application can go through multiple stages throughout its life cycle—two of the most common stages would be development and production. Specific configurations can be set up to host the app in its various stages. These configured habitats are known as server tiers or environments.

Development and production codes have different requirements. For instance, during development we will most likely want a detailed error output to the client, for debugging purposes. In production, we protect ourselves from opportunistic exploitation by revealing as little internal information as possible.

Express has an env setting that determines its value from an operating system environment variable, NODE_ENV, falling back to the value of 'development' if NODE_ENV isn't set. This allows us to define different settings for different environments within our app.

Getting ready

We'll need our project folder (nca) from the previous recipe.

How to do it...

Let's take a look at the default...