To store DB config in a Node.js and Express app, we store it in an .env file.
For instance, we write
DATABASE_PASSWORD=pw
DATABASE_NAME=some_db
in our .env file.
Then we write
require("dotenv").config();
const password = process.env.DATABASE_PASSWORD;
to load the .env file with the dotenv
package.
And then we get the DATABASE_PASSWORD
environment variable value with process.env.DATABASE_PASSWORD
.