Basic Node and Express: use the env.file

Hello there,

All of you logic must be held within the /json route:

const messageStyle=process.env.MESSAGE_STYLE;
console.log(messageStyle);

Any code outside of the route, will only be computed once. This happens at startup of the server, and never again. So, messageStyle never changes, and the else statement will never run.

Hope this clarifies.

1 Like