'how to set env in Sheel for node.js [closed]
Solution 1:[1]
In Powershell,
$Env:CONF = 'Hello, World!'
Solution 2:[2]
npm install dotenv --save
In your project root add .env file. Make sure you have the following in your .env file
CONF=SOME_DATA
In your js file add this
require('dotenv').config()
console.log(process.env.CONF) // remove this after you've confirmed it working
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rohit Gupta |
| Solution 2 | Cris |

