the problem seems to be with mongoose & mongodb packages as it works fine when
mongoose.connect('mongodb+srv://mydb:<password>@cluster0.w1opr.mongodb.net/test?retryWrites=true&w=majority');
is removed it also works fine on repl.it cloud env here is my code
var express = require('express');
var ejs = require('ejs');
var app = express();
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
mongoose.connect('mongodb+srv://mydb:<password>@cluster0.w1opr.mongodb.net/test?
retryWrites=true&w=majority');
app.set('view engine','ejs')
app.use(bodyParser.urlencoded({extended: true}));
.
.
.
app.listen(3000,function(){
console.log('Server is running on port 3000');
});