timeout added to server

parent 709f43ea
...@@ -3,3 +3,6 @@ node_modules ...@@ -3,3 +3,6 @@ node_modules
# # Local Netlify folder # # Local Netlify folder
# .netlify # .netlify
# Local Netlify folder
.netlify
{ {
"siteId": "37e01770-610a-40d2-8f9a-1331d619ede1" "siteId": "8f075393-d25d-4311-b131-52d4744be01d"
} }
\ No newline at end of file
...@@ -17,7 +17,11 @@ app.use(express.urlencoded({ extended: true })); ...@@ -17,7 +17,11 @@ app.use(express.urlencoded({ extended: true }));
app.use(express.json()); app.use(express.json());
// Create a reusable MongoClient instance for connection pooling // Create a reusable MongoClient instance for connection pooling
const client = new MongoClient(connectionString); const client = new MongoClient(connectionString,{
useNewUrlParser: true,
useUnifiedTopology: true,
connectTimeoutMS: 30000, // Connection timeout in milliseconds
});
client.connect() client.connect()
.then(() => { .then(() => {
console.log("Connected to MongoDB"); console.log("Connected to MongoDB");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment