Last active
October 28, 2020 20:05
-
-
Save robertoandres24/dba7fe6df11e9ce5176837d66ba51299 to your computer and use it in GitHub Desktop.
mongo db basic connection
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 connect = async function () { | |
try { | |
await mongoose.connect('mongodb://localhost:27017/graphql-test', { | |
useNewUrlParser: true, | |
useUnifiedTopology: true, | |
}) | |
console.log('Mongo DB is connected...') | |
} catch (error) { | |
console.log('something went wrong') | |
console.log(error) | |
} | |
} | |
module.exports = { | |
connect, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment