Skip to content

Commit

Permalink
pushing local code
Browse files Browse the repository at this point in the history
  • Loading branch information
realpxd authored Jan 26, 2024
1 parent 3df6277 commit 42a8091
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions x-clone-backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,20 @@ app.use(express.json())
const port = process.env.PORT || 5000
const uri = process.env.ATLAS_URI



const connectDB = async () => {
console.log('Connecting to MongoDB with URI:', uri);
try {
await mongoose.connect(uri)
.then(() => console.log('"Connected to database"'))
.catch((err) => {
console.log('Error connecting to database: ', err);
console.log('Retrying connection in 5 seconds...');
console.log('Connecting to MongoDB with URI:', uri);
setTimeout(() => {
connectDB()
}, 5000);
})
} catch (err) {
console.log('Error connecting to database: ', err);
console.log('Retrying connection in 5 seconds...');
console.log('Connecting to MongoDB with URI:', uri);
setTimeout(() => {
connectDB()
}, 5000);
Expand Down

0 comments on commit 42a8091

Please sign in to comment.