What exactly is an environment variable in Node/Express? What exactly is an environment variable in Node/Express? express express

What exactly is an environment variable in Node/Express?


To add to what others said in the comments, one way to set these variables is as you launch your node.js program, for example:

PORT=9100 node server.js

Another way it to set the variable first and make it available (with EXPORT) as Dave Newton indicated:

export PORT=9100node server.js