Seeking advice on deploying a MERN app onto Heroku. I have the mongodb URI declared in a config file locally, but on Heroku I am using process.env.mongoURI
. How can I adjust my code to use the local config file when running locally and the Heroku config when running on Heroku? Here is what I have attempted so far.
if (process.env) {
const keys = null
} else {
const keys = require('./config/keys')
}
let db = '';
if (process.env) {
db = process.env.mongoURI
} else {
db = keys.mongoURI
}