Skip to content

Instantly share code, notes, and snippets.

@rikkrome
Created July 6, 2018 08:10
Show Gist options
  • Save rikkrome/8997e3ba0f948c5bc0ddcc227ff77f3c to your computer and use it in GitHub Desktop.
Save rikkrome/8997e3ba0f948c5bc0ddcc227ff77f3c to your computer and use it in GitHub Desktop.
mongoose connect
// DB Config
const db = require('./config/keys').mongoURI;
// connect to mongoDB
mongoose
.connect(db)
.then(() => {
console.log('MongoDB Connected');
})
.catch(err => {
console.log(err);
console.log('MongoDB Not Connected');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment