motdotla/dotenv

In ES6 DOTENV enviroment not getting

paraschouhan15 opened this issue · 2 comments

**I have tried to get dotnev enviroment but getting undefined
//this is code i am using

`import express from 'express';
import dotenv from 'dotenv'

dotenv.config()

console.log(process.env.PORT)

const app = express();

//middlewares

app.get('/', (req, res) => {
res.send(
"

Welcome to my aapp

"
);
})
//port

app.listen(8000, () => {
console.log(Server running on port number 8000)
})
`

I have DOTENV file in which declared
PORT = 8000

@paraschouhan15 This is the syntax for ES6
image