From the course: Angular: Creating and Hosting a Full-Stack Site

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Environment variables

Environment variables

From the course: Angular: Creating and Hosting a Full-Stack Site

Start my 1-month free trial

Environment variables

- [Instructor] Okay, so previously we saw how to point our hapi server at the cloud based MySQL instance that we created. However, in real life when we have several different databases available for our back end to connect to, we'll want to have a way to break those details out into separate files that get loaded into our server automatically, and the way that we generally do this in full stack apps is by using something called environment files. Basically, environment variables just contain a number of different variables and values that should be different based on where our code is being executed from. So for example, what the values that we passed to this create connection to be different depending on whether we're running our server locally, or whether it's running on the cloud. So here's how we use environment files on a node server. We're going to start off by installing a package called dotenv, that will…

Contents