So, I connected to database with the following code:
const mongoose = require('mongoose');
mongoose.connect(process.env.DB, {useNewUrlParser: true, useUnifiedTopology: true});
mongoose.connection.once("open", () => {
//routes
}).on("error", (error) => {
console.log("Database connection error:", error);
});
};
and no matter what I tried, the routes don’t work. Then, I created new, blank repl and tried the same exact thing, and this time, everything works fine.
What am I doing incorrectly?
Challenge: Issue Tracker
Link to the challenge: