16 lines
294 B
JavaScript
16 lines
294 B
JavaScript
|
|
||
|
const mongoose = require('mongoose')
|
||
|
const dotenv = require('dotenv')
|
||
|
dotenv.config();
|
||
|
|
||
|
mongoose
|
||
|
.connect(process.env.DB_CONNECT, { useNewUrlParser: true })
|
||
|
.catch(e => {
|
||
|
console.error('Connection error', e.message)
|
||
|
})
|
||
|
|
||
|
const db = mongoose.connection
|
||
|
|
||
|
module.exports = db
|
||
|
|