Reputation: 8763
I am trying to deploy my app online and therefore I need to use different files depending on the environment. However, I don't know how to detect which environment I am working in.
Basically I am just looking for a variable which enables me to say if I am in development or in production to specify my static routes. How can I do this?
Upvotes: 0
Views: 184
Reputation: 3144
Well this isn't a complete answer, but process.env
is the Node.js portal to the environment variables used to start the app.
So, if you had your environment set via the NODE_ENV
variable (which is a pseudo-standard for Node), you could do the following:
if (process.env.NODE_ENV === "production") {
doProductionThings();
} else {
doDevelopmentThings();
}
Upvotes: 4