One important role of the configuration file in an application is to determine the environment in which the application is running. Scott explains how using the process.env.NODE_ENV allows him to set specific environment URLs, application secrets, or logging settings.
(flute music)…- So on a, like, configuration note,…we can process.env.NODE_ENV,…like I was saying before,…that variable, to tell our application…what environment it's running in.…And the possible options that we use as a community…is going to be some variance of these three,…but usually these three.…So it's either you're in testing,…development,…or production.…By default, you're in nothing,…so you have to set a default yourself.…So it's a good practice, or at least in my opinion,…to just set it to development by default.…
So, let's assume you're always in development…until you specifically change it…from production or testing.…So those are the common ones.…So depending on the ENV, we can change things in our app…like database URLs,…or toggle logging on and off,…that way we don't have to go in…and erase every single,…like, "Oh, where's that constant log,…let me go find it and erase it."…We can just turn it off with an environment variable,…like, turn off all logging.…All right?…We can also set and reference other environment variables.…
This course was created by Frontend Masters. It was originally released on 12/30/2015. We're pleased to host this training in our library.
- Executing Node.js
- Using Express
- What is middleware?
- Testing in Node.js
- Using Mongo with Node.js
- Data modeling
- Querying data with Mongoose
- Identifying sensitive routes
- Configuring the deployment
Skill Level Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
Building APIs Using Hapi in Node.jswith Kirsten Hunter2h 23m Intermediate
2. REST APIs
5. Organization and Configuration
7. Data Modeling
10. Securing Routes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.