// const mongoose = require('mongoose')
// const { MONGO_DBNAME, MONGO_HOST, MONGO_PORT } = process.env
// mongoose.connection.on('error', (error) => {
//   console.log('mongodb connection failed! ', error.message)
// })
// const startMongoDB = () => {
//   mongoose.connect(`mongodb://${MONGO_HOST}:${MONGO_PORT}/${MONGO_DBNAME}`, {
//   })
// }
// module.exports = startMongoDB

const mongoose = require('mongoose')
mongoose.connection.on('error', (error) => {
  console.log('mongodb connection failed! ', error.message)
})
mongoose.connection.on('open', function () {
  console.log('Database Connected! ')
})
const startMongoDB = () => {
  mongoose.connect(process.env.DATABASE_URL, {
    authSource: 'admin'
  })
}
module.exports = startMongoDB
