Created
February 10, 2021 08:26
-
-
Save gunaevart/b5ddf771c45f6995f0b4001f6cf13f36 to your computer and use it in GitHub Desktop.
Connect cloud mongodb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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