forked from slu-cs/project-finalproject-charlieamberconner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.js
19 lines (15 loc) · 526 Bytes
/
db.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//file with function for connecting to the database
const mongoose = require('mongoose');
module.exports = function() {
// Avoid warnings
mongoose.set('useNewUrlParser', true);
mongoose.set('useUnifiedTopology', true);
mongoose.set('useCreateIndex', true);
mongoose.set('useFindAndModify', false);
// Start connecting
mongoose.connect('mongodb://localhost/project-finalproject-charlieamberconner');
// Log errors
mongoose.connection.on('error', function(error) {
console.error(error.stack);
});
};