Heroku’s CLI has a feature that allows us to run application locally in a “heroku production-like” environment
This is a great way to catch issues before deploying the production
.env.local
to .env
When running heroku locally it, heroku will automatically look for the .env
(and not .env.local
) for any potential environment variables
Run the following command from the project folder to copy .env.local
to .env
$ cp .env.local .env
Remember we needed .env.local
to meet Parcel’s requirements of using environment variables using its web server
Add .env
to .gitignore
.env.local
/node_modules
.env
In your terminal, run the following command (from within the project folder) to start the application locally using heroku
$ heroku local
Heroku’s local default web server is http://localhost:5000
, navigate to this url in your browser and confirm that the application works as expected