mirror of
https://github.com/SkalaraAI/waitlist.git
synced 2025-04-09 21:20:15 -04:00
update db
This commit is contained in:
parent
60183a37c5
commit
fb0685adf9
13
lib/db.ts
13
lib/db.ts
|
@ -12,10 +12,15 @@ let client =
|
||||||
: { conn: null, promise: null };
|
: { conn: null, promise: null };
|
||||||
|
|
||||||
if (!client.promise) {
|
if (!client.promise) {
|
||||||
client.promise = MongoClient.connect(uri).then((mongoClient) => {
|
client.promise = MongoClient.connect(uri)
|
||||||
client.conn = mongoClient;
|
.then((mongoClient) => {
|
||||||
return mongoClient;
|
client.conn = mongoClient;
|
||||||
});
|
return mongoClient;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Failed to connect to MongoDB", error);
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default client;
|
export default client;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user