December 2018
Intermediate to advanced
642 pages
15h 5m
English
If you want to simplify working in development, but also make it easy for others when pushing code to production or other environments, you may want to look into dotenv, an npm package that lets you work with environment variables in text files. Install the package with npm install dotenv --save, and then create a file at the root of your project with the .env extension, which contains the desired variables values:
DB_HOST=127.0.0.1DB_USER=fkerekiDB_PASS=modernJS!!DB_SCHEMA=worldSECRET_JWT_KEY=modernJSbook
Then, in your code, you only need to add a single line, and that will load and merge all the definitions in your .env file into process.env. Of course, if you only want to use this feature in development (as it was originally ...
Read now
Unlock full access