Answers for "create .env file nodejs"

8

node dotenv

require('dotenv').config();

console.log(process.env.MY_ENV_VAR);
Posted by: Guest on October-07-2020
-1

.env file make in nodejs

// server.jsconsole.log(`Your port is ${process.env.PORT}`); // undefinedconst dotenv = require('dotenv');dotenv.config();console.log(`Your port is ${process.env.PORT}`); // 8626
Posted by: Guest on June-08-2021

Browse Popular Code Answers by Language