You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paste/db.js

16 lines
377 B
JavaScript

9 years ago
var config = require('config');
var util = require('util');
var mongoose = require('mongoose');
module.exports = function () {
mongoose.connect(config.db);
mongoose.connection.once('open', function () {
util.log('MongoDB connection open');
});
mongoose.connection.on('error', console.error.bind(console, 'MongoDB connection error:'));
return mongoose.connection;
}