const mongoose = require('mongoose') require('dotenv').config() mongoose.connect(process.env.MONGODB_URI, { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true }) mongoose.connection.on('connected', () => { console.log('Mongoose connected') }) mongoose.connection.on('error', (err) => { console.log(`Mongoose connected error ${err}`) }) mongoose.connection.on('disconnected', () => { console.log('Mongoose disconnected') })
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter