You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
345 B
JavaScript
16 lines
345 B
JavaScript
const mongoose = require('mongoose');
|
|
|
|
const connectDB = async () => {
|
|
try {
|
|
await mongoose.connect(process.env.MONGO_URI, {
|
|
useNewUrlParser: true,
|
|
useUnifiedTopology: true,
|
|
});
|
|
console.log('Database Connected');
|
|
} catch (err) {
|
|
console.error(err.message);
|
|
process.exit(1);
|
|
}
|
|
};
|
|
|
|
module.exports = connectDB; |