I have this route defined, but any requests made to it get\'s stuck on \'pending\' and runs forever.
When I log the code, I see 1
followed by 4
Until you call mongoose.connect
, your mongoose queries will simply be queued up.
Add code like this in your startup code to connect:
mongoose.connect('mongodb://localhost/test', function(err) {
if (err) {
console.err(err);
} else {
console.log('Connected');
}
});
In the connection string, replace test
with the name of your database.