Open tinkerFAUJ opened 4 years ago
I have the same problem.
I added mongodb dependency to backend, and also used whole driver for connection
Can you please explain the process in a elaborated way, I'm having the same issue. Thanks.
Added mongodb dependency to package.json file for backend.
db connection in server.js
const uri = process.env.ATLAS_URI; mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true } ); const connection = mongoose.connection; connection.once('open', () => { console.log("MongoDB database connection established successfully"); })
const tasksRouter = require('./routes/tasks'); const usersRouter = require('./routes/users');
app.use('/tasks', tasksRouter); app.use('/users', usersRouter);
app.listen(port, () => {
console.log(Server is running on port: ${port}
);
});
hi thanks a lot for a great tutorial. I am new to nodejs and the whole mern stack. I have executed the code as instructed but the connection to mongoDB atlas is not working. The confirmation string about the successful connection is displayed on the console. also the mongoDb cluster dashboard does not show any connections