The below screenshot shows my file structure in VS code. I have used npm concurrent to run both backend and frontend simultaneously. My problem is env file is not recognized in the server file. Please tell me what is wrong here.
Second screenshot for illustration:
You can specify the path where the .env file is to dotenv package.
Please modify the following line of code to
require("dotenv").config();
like this:
require("dotenv").config({path: "./back-end/.env"});