I have been trying to run my server but still facing this error.
I am in the initial stage of my full-stack application ( Mern stack) .
At first, I started working on backend and stuck while connecting with db.
I am attaching the picture and complete code with link for more reference.
import express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import cors from 'cors';
const app = express();
app.use(bodyParser.json({ limit: '30mb', extended: true }))
app.use(bodyParser.urlencoded({ limit: '30mb', extended: true }))
app.use(cors());
const CONNECTION_URL = '
';
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.message));
mongoose.set('useFindAndModify', false);