Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cubap committed Oct 15, 2024
1 parent 305dfcd commit 668f98b
Show file tree
Hide file tree
Showing 6 changed files with 365 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MONGO_URI=mongodb://localhost:27017
PORT=5000
16 changes: 16 additions & 0 deletions config/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const mongoose = require('mongoose');

const connectDB = async () => {
try {
await mongoose.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
console.log('MongoDB connected');
} catch (err) {
console.error(err.message);
process.exit(1);
}
};

module.exports = connectDB;
Loading

0 comments on commit 668f98b

Please sign in to comment.