February 2019
Beginner
694 pages
18h 4m
English
Now that we have an Express server running, let's refactor the code to allow for some simple configuration. As mentioned earlier, the configuration of an Express server can easily change depending on where it is deployed. On a local development environment, we may want to use a local SMTP server, for example, but in a testing and production environment, we would want to use the real thing. Having a set of config files to drive these settings means that we can deploy the same code to multiple environments without having to recompile the code.
To easily parse configuration files, we will use a Node package named config, which can be installed as follows:
npm install config npm install @types/config --saveDev
Read now
Unlock full access