0

I know that we must not commit the .env file to Heroku by adding the .env file to .gitignore but should I keep this line of code in the app.js source file?

require("dotenv").config();

Or should be delete this line before git pushing?

I have another related question. In order for the node app to work with Heroku, they make us add this to the app.js :

const port = process.env.PORT

How can it work without having required the dotenv module? Are they adding this requirement to the app.js file as part of the deployment process?

0 Answers0