Skip to content

Commit 80621c9

Browse files
committed
Merge pull request #43 from ksenia0822/startDbPromise
Modifying startDbPromise to return the db object
2 parents e9d6b6b + 3fbec85 commit 80621c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

generated/server/db/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ var db = mongoose.connect(DATABASE_URI).connection;
1313
// anywhere the User model needs to be used.
1414
require('./models');
1515

16+
// Modifying startDbPromise to return the db object to have an access to it when .then on startDbPromise
1617
var startDbPromise = new Promise(function (resolve, reject) {
17-
db.on('open', resolve);
18+
db.on('open', function() {
19+
resolve(db)
20+
});
1821
db.on('error', reject);
1922
});
2023

0 commit comments

Comments
 (0)