I installed dotenv, created a .env file and wrote PORT = 5000
into it, but for some reason it says that the value in it is undefiend. What is the problem?
File location:
└── src
├── index.js
└── .env
require('dotenv').config();
const express = require('express');
const PORT = process.env.PORT;
const app = express();
app.get('/', (req, res) => {
res.send("Test");
});
app.listen(PORT, () => {
console.log(`${PORT} server has been started`);
});