var mongoose = require('mongoose'); var start = function() { return new Promise((resolve, reject) => { //Set up default mongoose connection var mongoDB = 'mongodb://127.0.0.1/kairoscope_dev'; mongoose.connect(mongoDB, {useNewUrlParser: true, useUnifiedTopology: true}).then( () => { /** ready to use. The `mongoose.connect()` promise resolves to mongoose instance. */ console.log("Database connected"); resolve(); }, err => { /** handle initial connection error */ console.log("Error connecting to database"); reject(err); } ); }); } module.exports.start = start;