Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 2x 2x 2x 2x 2x 2x 2x 2x 2x | import * as mongoose from 'mongoose';
import * as bluebird from 'bluebird';
export function connect(uri: string) {
(<any>mongoose).Promise = bluebird;
mongoose.connect(uri).then(() => {
console.log('success connected to', uri);
});
const db = mongoose.connection;
db.on('error', (err: any) => {
throw new Error('unable to connect to database at ' + uri + err);
});
return db;
} |