UNPKG

start-dev-faster

Version:

Quickly Start developing your frontend, backend and Fullstack apps with the MERN Stack.

20 lines (18 loc) 509 B
import mongoose from 'mongoose' const connectDB = async () => { try { const connect = await mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true, useFindAndModify: false, }) console.log( `Database is connected on ${connect.connection.host}`.cyan.underline.bold ) } catch (err) { console.error(err.message.red.underline.bold) process.exit(1) } } export default connectDB