mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 15:47:48 +01:00
19 lines
361 B
JavaScript
19 lines
361 B
JavaScript
const mongoose = require('mongoose');
|
|
const config = require('./');
|
|
|
|
async function connect() {
|
|
const { host, port, name } = config.db;
|
|
const connectionString = `mongodb://${host}:${port}/${name}`;
|
|
|
|
await mongoose.connect(connectionString);
|
|
}
|
|
|
|
async function disconnect() {
|
|
await mongoose.disconnect();
|
|
}
|
|
|
|
module.exports = {
|
|
connect,
|
|
disconnect,
|
|
};
|