I know this error has been asked a million times but I believe that the answers are not the correct ones or are not the most efficient.
// import all libraries
const express = require('express');
const cors = require('cors');
const mongoose = require('mongoose');
const app = express();
require('dotenv').config();
// setup connections
mongoose.connect(process.env.MONGODB_URL)
.then(() => console.log("Connected to DB 