mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-29 08:07:48 +01:00
smarter db connection
tests
This commit is contained in:
13
config/db.js
13
config/db.js
@@ -4,4 +4,15 @@ const config = require('./');
|
||||
const { host, port, name } = config.db;
|
||||
const connectionString = `mongodb://${host}:${port}/${name}`;
|
||||
|
||||
mongoose.connect(connectionString);
|
||||
async function connect() {
|
||||
await mongoose.connect(connectionString);
|
||||
}
|
||||
|
||||
async function disconnect() {
|
||||
await mongoose.disconnect();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
connect,
|
||||
disconnect,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user