Skip to content

Instantly share code, notes, and snippets.

@gunaevart
Created February 10, 2021 08:26
Show Gist options
  • Save gunaevart/b5ddf771c45f6995f0b4001f6cf13f36 to your computer and use it in GitHub Desktop.
Save gunaevart/b5ddf771c45f6995f0b4001f6cf13f36 to your computer and use it in GitHub Desktop.
Connect cloud mongodb
const mongoose = require('mongoose')
const dbConfig = (req, res, next) => {
mongoose.connect('mongodb+srv://gunaevart:[email protected]/app?retryWrites=true&w=majority',{
useNewUrlParser: true
})
.then(() => console.log('connect ok'))
.catch(err => console.log(err))
next()
}
module.exports = dbConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment