node.js - mongoose连接问题
PHPz
PHPz 2017-04-17 15:25:47
0
1
467

我在app.js里面用mongoose.connect连接好了数据库,然后在其他模块里require(‘mongoose’).connection.once(‘open’)怎么触发不了啊,阻塞在那儿,不是说打开一次就好了,然后其它地方都是使用这个默认的连接吗

PHPz
PHPz

学习是最好的投资!

reply all(1)
Ty80

Are other modules separated from app.js? Under normal circumstances, other modules will be imported into app.js for execution, so that other modules do not need to worry about the database connection, and can be connected only once in app.js.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template