0
const app=require('./app')

const dotenv =require('dotenv');
const PORT=3000;
 

dotenv.config({path:'backend/config/config.env'})

app.listen(process.env.PORT,()=>{
    console.log(`server Started on Port: ${process.env.PORT} in ${process.env.NODE_ENV}mode`);

})

const app=require('./app')

const dotenv =require('dotenv');
const PORT=3000;
 

dotenv.config({path:'backend/config/config.env'})

app.listen(process.env.PORT,()=>{
    console.log(`server Started on Port: ${process.env.PORT} in ${process.env.NODE_ENV}mode`);

})

I am getting error as follows:

server Started on Port: undefined in undefined mode

Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75
Buz S
  • 1

1 Answers1

0

You need to make a file on the root say local.env of your project and assign variable values in that.

PORT=3000
NODE_ENV=DEVELOPMENT
Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75