concept environment in category angular

appears as: environments, n environment, environment, environments
Getting MEAN with Mongo, Express, Angular, and Node.js 2ED

This is an excerpt from Manning's book Getting MEAN with Mongo, Express, Angular, and Node.js 2ED.

With this command, npm downloads and installs the new package in the node_modules folder. The --save flag tells npm to add this package to the list of dependencies in the package.json file. As of npm version 5, the --save flag is no longer required, as NPM saves changes to the package.json file automatically. We’ve added it here for completeness. When this command is run, npm generates a package-lock.json file to maintain versions of dependencies between environments, which is helpful when you’re deploying from development to a live server.

It’s important to manage opening and closing your database connections properly in every application you create. If you use an environment with different process termination signals, you should ensure that you listen to them all.

You can test this update to the code locally before pushing the code to Heroku by setting the environment variable as you start the application from terminal. The Mongoose connection events you set up earlier output a log to the console when the database connection is made, verifying the URI used.

Listing 10.28. Adding an environment variable to the development environment
export const environment = {
  apiBaseUrl: 'http://localhost:3000/api',        #1
  production: false
};