CSE316/hw4/server/db/index.js

16 lines
294 B
JavaScript
Raw Permalink Normal View History

2022-05-23 06:22:34 -04:00
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