throw new error_1.MongoAPIError(‘URI must include hostname, domain name, and tld’);
Hello everyone i am facing a error while connecting my backend to mongodb . I am student and i am learning full stack while developing my project i am facing the above error.
I was trying to connect my mongodb with my backend server but it wont happen is send me an error that i mentioned above.
type here
const connect = async () => {
try{
await mongoose.connect('mongodb+srv://rahulghatge166:Rahul@[email protected]/Booking?retryWrites=true&w=majority');
console.log('Connected to MongoDb')
}catch(error) {
throw error
}
}
mongoose.connection.on('disconnected', () => {
console.log('mongoDb disconnected')
})
mongoose.connection.on('connected',() => {
console.log('mongoDb is connected')
})
your text
The above is my code i had written