Getting ERROR while connecting MongoDB database to express server

Issue

Error:
node: internal /errors :465
ErrorCaptureStackTrace(err) ;

enter image description here

Here is my code:

import express from "express";
import bodyParser from "body-parser";
import mongoose from "mongoose";

const app = express();
app.use(bodyParser.json({ Limit: "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));

mongoose.connect ("My Uri").
then(()=>app.listen(5000, ()=>console.log("Listening")));

Solution

Can you check if your IP is whitelisted from your MongoDB atlas?

Answered By – Drashti Kheni

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published