dotenv file is not recognized by server nodejs

this is my first mern stack project ever and i’m trying to push it to github.
i am using mongoose so i had to hide the login and pwd of my account i looked it up and found the .env solution.
I created a dot env file

Port=5000
CONNECTION_URL=mongodb+srv://[email protected]/++++++?retryWrites=true&w=majority

i ran npm i dot env

then i added import statement :

import dotenv from ‘dotenv’;

and the problem seems to occur here,
i tried :

dotenv.config()
require('dotenv').config();

the code to of my index js if it helps to solve the solution :

const PORT = process.env.PORT|| 5000;

mongoose.connect(CONNECTION_URL, { useNewUrlParser: true, useUnifiedTopology: true })
  .then(() => app.listen(PORT, () => console.log(`Server Running on Port: http://localhost:${PORT}`)))
  .catch((error) => console.log(`${error} did not connect`));

mongoose.set('useFindAndModify', false);

can anyone help me solve this up i would really appreciate it thank you ^^