0

I'm trying to create different environment (production and development) to make sure the production database is not touched during developing. There were lots of answers from this post Toggle between multiple .env files like .env.development with node.js, and what I have for now is

    "start": "export NODE_ENV=development&& nodemon server.js",
    "prod": "export NODE_ENV=production&& nodemon server.js"

This method works but I'm not really sure why the OP said "gets messy when using multiple variables", and there are other articles/posts saying that it is not a good practice to do "NODE_ENV=development" in packages.js.

My team is currently developing this website, but there will be another team to deploy it, so I need to make sure that the database and other resources such as API tokens can be switched to the one used in production env by simply running npm run prod

So my question is what could be the potential issues of this method? Is there any better way to achieve this? Thanks

abcXYZ
  • 119
  • 2
  • 7

0 Answers0